Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-06-21 09:25:25


----- Original Message -----
From: "Herve Bronnimann" <hbr_at_[hidden]>

> I would favor giving just a single class (not two) and as a result
> getting rid of the difference in interface between the class template
> and its specialization (which could be evil in some cases):
>
> template <class T>
> struct identity
> : std::unary_function<T,T> // defines argument_type, result_type
> {
> typedef T type; // somewhat redundant with unary_function,
> // but apparently to satisfy mpl's interface
>
> template <class U> struct rebind { typedef identity<U> other; };
>
> T operator()(T x) const { return x; }
> };

Well, I think I got the specialization wrong; I've forgotten exactly what
the MPL lambda expression protocol is, but I'm fairly certain a real
specialization is needed. I'll leave it up to Aleksey to give details...

-Dave


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