[C++-sig] problems with complex

Enrico Ng enrico at fnal.gov
Thu Aug 8 21:10:01 CEST 2002


I am new to boost and am attepting to use V2.
I have wrapped several functions, but have run into trouble with
"complex" ones

I get an error when compiling.  I am using version 3.1 of the GNU
compiler.

pysupercode.cc: In function `void init_module_supercode()':
pysupercode.cc:147: no matching function for call to `
   SuperCode::Array3<std::complex<double> >::Array3(const char[14])'
sctypes.h:251: candidates are: SuperCode::Array3<T>::Array3(const
   SuperCode::Array3<T>&) [with T = std::complex<double>]
sctypes.h:214:                 SuperCode::Array3<T>::Array3(int, int,
int)
   [with T = std::complex<double>]
pysupercode.cc:158: parse error before `)' token


I only get this error with the complex class, the other one works fine.
Is there something special with complex that I am forgetting?

Thanx,
Enrico Ng <enrico at fnal.gov>


Here is some of the code:
from sctypes.h
=========================================================
namespace SuperCode {

template<class T> class Array3 {

 public:

  Array3<T>(int rows, int cols, int depth);
  Array3<T>(const Array3<T>& a3);
 ~Array3<T>();
  T    get(int i, int j, int k) const;
 ...


from pysupercode.cc
=======================================================
#include <boost/python/operators.hpp>
#include <boost/python/class.hpp>
#include <boost/python/module.hpp>


using std::complex;

namespace python = boost::python;
using namespace SuperCode;

BOOST_PYTHON_MODULE_INIT(supercode)
{
   python::module("supercode")

     .add(
   python::class_<Array3<int> >("IntegerArray3")
   .def_init(python::args<int,int,int>())
   .def_init(python::args<Array3<int>&>())
   .def("get", &Array3<int>::get)

...

     .add(
   python::class_<Array3<complex<double> >("ComplexArray3")
   .def_init(python::args<int,int,int>())
   .def_init(python::args<const Array3<complex<double> >&>())
   .def("get", &Array3<complex<double> >::get)

...







More information about the Cplusplus-sig mailing list