Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2002-04-19 21:08:23

> > 15. const operator->() and operator*()
> > Why don't they return const_pointer and const_reference appropriately? int
> > const& would not allow you to change the referenced object.

Speaking of smart_ptr would be nice to overload operator->* as
well. The preprocessor library can produce the necessary implementation so you
get something like this:

template<class T /* ... */> class smart_ptr {
        T* m_ptr;
        // ...
        template<class U> inline typename closure<U>::return_type operator->*(U
ptr) {
            return make_closure(m_obj, ptr);

This can be made to work for everything: pointers-to-data-members,
pointers-to-functions (in all their cv-qualified versions).

Well, almost everything--not functions that have an ellipsis.

Paul Mensonides

Boost list run by bdawes at, gregod at, cpdaniel at, john at