[C++-sig] problems with complex

David Abrahams dave at boost-consulting.com
Thu Aug 8 22:41:21 CEST 2002


Suport requests 101: always give a complete copy of the error and show
which line of the source the error is occurring on. I can't correlate your
error message to the code excerpt you posted.

Can you post a minimal example from which I can reproduce your error?

-----------------------------------------------------------
           David Abrahams * Boost Consulting
dave at boost-consulting.com * http://www.boost-consulting.com


----- Original Message -----
From: "Enrico Ng" <enrico at fnal.gov>
To: <c++-sig at python.org>
Sent: Thursday, August 08, 2002 3:10 PM
Subject: [C++-sig] problems with complex


> 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)
>
> ...
>
>
>
>
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig





More information about the Cplusplus-sig mailing list