Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-05-02 07:51:06


From: "Andrei Alexandrescu" <andrewalex_at_[hidden]>
> template <class T, many parameters>
> class smart_ptr
> {
> ...
> };
>
> template <class T>
> struct ptr
> {
> typedef T* raw;
> typedef smart_ptr<T, some policies> shared;
> typedef smart_ptr<T, some policies> scoped;
> typedef smart_ptr<T, some policies> scoped_array;
> typedef smart_ptr<T, some policies> weak;
> typedef smart_ptr<T, some policies> std_auto;
> };
>
> Then access to these inner types is, I hope palatable to library
> users:
>
> void Transmogrify(ptr<Widget>::shared sp);

The only problem with this design is that ptr<T>::shared is a nondeduced
context; template writers must still use the full smart_ptr<T, P1, P2, P3,
...> syntax.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk