Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-11-26 05:08:01


David A. Greene wrote:
> I do need to be able to start at various points within the sequence.
> Your second solution fleshes out the design I had in mind, but I
> was out of town over the weekend so you beat me to the punch. :)

Actually, I wrote too much code in that "solution" ;). Just this would be
enough:

    template< typename T >
    struct intrusive_iter
    {
        typedef T type;
        typedef intrusive_iter<typename T::type> next;
    };

    template<>
    struct intrusive_iter<void_>
    {
    };
    
    template< typename T >
    struct intrusive_list
    {
        typedef mpl::nested_begin_end_tag tag; // not required
        typedef intrusive_iter<T> begin;
        typedef intrusive_iter<void_> end;
    };

No 'begin/end' specializations needed, and the 'tag' typedef is there only
to make some deficient compilers happy (Borland, in particular).

Aleksey


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