Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2002-10-02 13:53:59


Eric Woodruff wrote:
>
> shared_ptr_const is abiguous as to whether it is analagous to shared_ptr<T>
> const or shared_ptr<T const>.

How about const_shared_ptr? It's like const_iterator, as it refers to a
const object. You could even use:

const const_shared_ptr< Foo > foo = ...;

When experimenting with my own pointer class, I once tried (and later
removed it):

Foo::pointer foo; // read: Foo* foo;
Foo::const_pointer foo; // read: Foo* const foo;
const Foo::pointer foo; // read: const Foo* foo;
const Foo::const_pointer foo; // read: const Foo* const foo;

In the context where I tried it, all objects that should be usable with
my pointer class needed to be derived from a common base class. This
class was roughly:

template< typename T > class counted_object
{
   int counter_;

public:
   typedef pointer< const T > const_pointer;
   typedef pointer< T > pointer;
};

This may of course not be applicable here, but maybe it gives some
inspiration for someone else :)

Regards, Daniel

--
Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

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