Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-07-31 16:39:43


Jeremy Siek wrote:

> Can I write recursive lisp-style meta algorithms using MPL list (or any
> MPL class).

Depends on what do you mean by "lisp-style" :). Is this one Lisp-ish enough?

    template< typename Iter, typename End >
    struct size
    {
        enum { value = 1 + size< typename Iter::next, End >::value };
    };

    template< typename End >
    struct size<End,End>
    {
        enum { value = 0 };
    };

If not, what in particular is "non-conforming"?

Aleksey


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