Boost logo

Boost :

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


From: "Joel de Guzman" <djowel_at_[hidden]>

> identity is a nice name. However, the name itself does not imply
> that it is a metafunction. I know it would be longish but I feel
> that type_identity would be better (it's just 1 char longer than
> type_wrapper).

Or we could make it an identity for all seasons?

    template <class T = mpl::not_specified>
    struct identity : std::unary_function<T,T>
    {
        typedef T type;

        T operator()(T x) const
        {
            return x;
        }
    };

    template<>
    struct identity<mpl::not_specified>
    {
        template <class T>
        struct apply
        {
            typedef T type;
        };
    }

I'm sort of kidding... sort of.

-Dave


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