|
Boost : |
From: tom.widmer_at_[hidden]
Date: 2001-08-20 11:49:23
I found myself having to write this the other day, to allow me to use any smart pointer or a bare pointer generically. Is it worth adding it to smart_ptr.hpp?
template <class T>
struct smart_pointer_traits
{
typedef T smart_pointer_type;
typedef typename smart_pointer_type::pointer_type pointer_type;
typedef typename smart_pointer_type::reference_type reference_type;
typedef typename smart_pointer_type::value_type value_type;
};
template <class T>
struct smart_pointer_traits<T*>
{
typedef T* smart_pointer_type;
typedef T* pointer_type;
typedef T& reference_type;
typedef T value_type;
};
Tom
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk