[C++-sig] wrapping typedef equivalent types

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu Oct 20 07:35:29 CEST 2005


FWIW, I've used something like the following in a few places:

        .def("set_selected",
          (object(*)(
            object const&,
            af::const_ref<std::size_t> const&,
            e_t const&)) set_selected_unsigned_s)
      ;
      if (   boost::python::type_info(typeid(af::const_ref<std::size_t>))
          != boost::python::type_info(typeid(af::const_ref<unsigned>))) {
        result
          .def("set_selected",
            (object(*)(
              object const&,
              af::const_ref<unsigned> const&,
              af::const_ref<e_t> const&)) set_selected_unsigned_a)


I.e. the trick is to compare boost::python::type_info(typeid(X)).

For completeness, the full code is here: 
http://cvs.sourceforge.net/viewcvs.py/cctbx/scitbx/include/scitbx/array_family/boost_python/flex_wrapper.h?rev=1.60&view=auto

Cheers,
        Ralf



	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com



More information about the Cplusplus-sig mailing list