Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-09 13:03:08


By the way #1, the current method requires partial specialization for the
case you quoted, and one popular compiler won't support that for at least
one more release.

By the way #2, you can even make this change backward-compatible by
supplying this default implementation of container_gen:

template <class UnaryMetaFunction, class ValueType>
struct container_gen
{
    typedef typename UnaryMetaFunction::template apply<ValueType>::type
type;
};

You'd need some additional hackery which I can show you to work around an
MSVC6 compiler bug.

----- Original Message -----
From: "David Abrahams" <david.abrahams_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, January 09, 2002 12:50 PM
Subject: Re: [boost] BGL adjacency list container selectors

>
> ----- Original Message -----
> From: "Lie-Quan Lee" <llee_at_[hidden]>
>
> > With the current method of selecting component containers in BGL, if you
> > want to use your own allocator into component conainers, you define your
> > own selector. For example:
> >
> > struct my_vecS {};
> > template <class ValueType>
> > struct container_gen<my_vecS, ValueType> {
> > typedef std::vector<ValueType, MyOwnAllocator> type;
> > };
> >
> > This is simpler to users. Right?
>
> Let's look at a more realistic case:
>
> namespace my_company { namespace my_app {
> ...
> // Oh, I need a graph!
> struct my_vecS {};
> // Damn, need to specialize container_gen before I can declare the
> graph!
> }}
> namespace boost {
> template <class ValueType>
> struct container_gen<my_vecS, ValueType> {
> typedef std::vector<ValueType, MyOwnAllocator> type;
> };
> }
> namespace my_company { namespace my_app {
> // declare the graph now
> typedef boost::adjacency_list<my_VecS...
> }}
>
> --- Now, my version: ---
>
> namespace my_company { namespace my_app {
> ...
> // Oh, I need a graph!
> struct my_vecS {
> template <class ValueType>
> struct apply {
> typedef std::vector<ValueType, MyOwnAllocator> type;
> };
> };
> typedef boost::adjacency_list<my_VecS...
> }}
>
>
>
>
> Info: http://www.boost.org Send unsubscribe requests to:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk