
Boost : 
From: Samuel Krempp (krempp_at_[hidden])
Date: 20020625 06:16:21
On Thu, 20020620 at 21:14, David Abrahams wrote:
> suggested identity<> before; nobody seemed to get the whole metafunction
> idea, so for the record, I don't care all that much what we call it.
If I think of a "identity" metafunction, I would expect it to follow the
properties of a regular identity :
"x" is perfectly equivalent to "identity(x)"
But here "T" is equivalent to "identity<T>::type",
not just "identity<T>".
For me, it's not identity.. it's a bijective metafunction allright, but
not identity.
I thought injective metafunctions were usually called "wrappers" and in
fact those wrappers often are as much bijective as this identity<T>
template. The difference is just that this one is intended to serve as
as an identity metafunction. (since it's the closest we can get to such
a thing. there is no "let f(T) = T" possible here..)
So, personnally, I'd rather choose for a weaker, but correct, name based
on 'wrapper',
than a more precise, but slightly incorrect name based on 'identity'..
ah, I thought of a clear manifestation of the difference between a true
identity and this metafunction.
Mathematically, identity composed with itself is still identity.
So I'd expect
identity< identity<T> > to be the exact same thing as
identity<T>
And, unless you add a specialisation, it's not the case.
Still, the
T operator()(T x) const { return x; }
really is an identity.
So if it's included in the struct, it could be named identity<T>, due to
this function (rather than to the struct viewed as metafunction, which
is *not* an identity).
 Samuel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk