|
Boost : |
From: Herve Bronnimann (hbr_at_[hidden])
Date: 2002-06-21 14:55:46
On Fri, Jun 21, 2002 at 10:18:50AM -0400, David Abrahams wrote:
> i-s'pose-i-could-look-at-the-sandbox-ly y'rs,
Dave is right. Here's the code:
namespace boost {
template <class T>
struct identity
{
typedef T argument_type; // directly to avoid including <functional>
typedef T result_type; // directly to avoid including <functional>
typedef T type; // somewhat redundant with unary_function,
// but apparently to satisfy mpl's interface
template <class U> struct rebind { typedef identity<U> other; };
// allow identity to return an lvalue if lvalue is passed as argument
T const& operator()(T const& x) const { return x; }
T& operator()(T& x) const { return x; }
};
} // namespace boost
-- Hervé
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk