Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2003-07-16 15:58:11


Raoul Gough <yg-boost-users_at_[hidden]> writes:

> David Abrahams <dave_at_[hidden]> writes:
>
>> David Abrahams <dave_at_[hidden]> writes:
>>
>>> We probably ought to define a public referent<T> metafunction in
>>> namespace boost which implements that logic, so that people can
>>> specialize it.
>>
>> That's done; the docs still need to be updated to reflect that fact
>> though.
>
> Alright! So I can now specialize boost::referent for my own smart
> pointer template:
>
> namespace boost {
> template<class T> struct referent<utils::weak_ptr<T> > {
> typedef T type;
> };
> }

If neccessary. It usually isn't, though.

> Really seems a bit weird that boost::referent wasn't already
> invented in the type_traits portion of the library, since it can be
> applied to any kind of pointer, iterator, etc... Anyway, it has
> neatened up my code quite a bit, thanks.

It's a little quirky, yet. If you define an iterator with a nested
element_type member it will do the wrong thing.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net