|
Boost : |
From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2002-04-14 12:18:05
> How about DerivedToFront, could someone post an MPL implementation of
> it? Here I am pretty sure that MPL will at least have a compilation
> speed advantage , because Loki's algorithm is terribly inefficient. I
> should have used mergesort but... deadline pressure. Nobody complained
> so far :o).
Hey Andrei, the current version of Loki that I got from moderncppdesign.com has
a huge error--DerivedToFront doesn't recurse at all:
template<class TList> struct DerivedToFront;
template<>
struct DerivedToFront<NullType>
{
typedef NullType Result;
};
template<class Head, class Tail>
struct DerivedToFront< Typelist<Head, Tail> >
{
private:
typedef typename MostDerived<Tail, Head>::Result
TheMostDerived;
typedef typename Replace<Tail,
TheMostDerived, Head>::Result L;
public:
typedef Typelist<TheMostDerived, L> Result;
// ^ error
// should be...
typedef Typelist<TheMostDerived, typename DerivedToFront<L>::Result>;
};
Paul Mensonides
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk