Boost logo

Boost :

From: Xavier Warin (xavier.warin_at_[hidden])
Date: 2001-04-10 02:24:51


While trying to bind C++ with Python by BPL, i get the following error
with KCC (it works with GCC) :

error: no instance of overloaded function
          "boost::python::class_builder<T, U>::def [with T=Data,
          U=boost::python::detail::held_instance<Data>]" matches the
argument
          list
            argument types are: (<unknown-type>, const char [8])
      Data_class.def(&Data::get_val, "get_val");
                 ^
on the following example :

class Data {
private :
  const double w ;
public :
  Data( double v ) : w(v) {} ;
  ~Data() {}

  double get_val() { return 1; }
  double get_val(double x) { return x+1 ;}
} ;

extern "C"
void initriskneut()
{
  try
  {
    // Create an object representing this extension module.
    python::module_builder this_module("alltest");

    // Create the Python type object
    boost::python::class_builder< Data > Data_class(this_module, "Data"
);
    Data_class.def(boost::python::constructor< double >());
    Data_class.def(&Data::get_val, "get_val");
  }
  catch(...)
  {
    boost::python::handle_exception(); // Deal with the exception for
Python
  }
}

This error only happens when get_val has two definitions (in the data
object).
Do you think it's a KCC bug or a BPL bug.
Thank you

Xavier


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