|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-11-27 19:21:07
----- Original Message -----
From: "Jonathan H Lundquist" <jhl_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, November 27, 2001 7:05 PM
Subject: [boost] RE: Submission: typelist
> Personally, I prefer type2type, simply because I already use the name
> 'identity' for the following:
>
> template<typename T>
> struct identity : public unary_function<T, T> {
> const T& operator()(const T& x) const throw()
> {
> return x;
> }
> };
Firstly, runtime and compile-time behavior are different domains, and so may
well live in different namespaces.
Secondly, Aleksey and Emily were just discussing a hybrid:
template<typename T>
struct identity : public unary_function<T, T> {
const T& operator()(const T& x) const throw()
{
return x;
}
typedef T type;
};
Now identity works at runtime and at compile-time. Cute, or perhaps... MOST
NEFARIOUS!!
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk