[C++-sig] Dereferenceable concept proposal

Pierre Barbier de Reuille pierre.barbier at cirad.fr
Thu Nov 6 18:46:18 CET 2003

In the project I'm working on, we are using intrusive smart pointers.
When trying to export classes used with such smart pointers, I had a
problem with the dereferenceable concept. This concept require the
existence of a 'get' method, but the smart pointer we use does not have
this method (ie. the method exists but with another name). We cannot
rename the method for it will break to many code, and not only code from
us. So, would it be possible to replace this requirement by something
like having an expression :

get_pointer_from_smart_pointer()( smart_pointer )

get_pointer_from_smart_pointer being a template with this default
definition :

template <class T>
struct get_pointer_from_smart_pointer
  typename pointee<T>::type* operator()(const T& ptr) const
      return ptr.get();

This way, it should not break the existing code and we should be able to
use uour smart pointer by just redefining this class.

The main problem is, I'm not really able to evaluate the changes needed
in the Boost.Python code. And perhaps this solution has tons of defaults
I don't see :-/


Pierre Barbier de Reuille

INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP
Botanique et Bio-informatique de l'Architecture des Plantes
TA40/PSII, Boulevard de la Lironde

tel   : (33) 4 67 61 65 77    fax   : (33) 4 67 61 56 68 

More information about the Cplusplus-sig mailing list