[C++-sig] problems with complex

David Abrahams dave at boost-consulting.com
Fri Aug 9 00:43:16 CEST 2002


From: "Enrico Ng" <enrico at fnal.gov>

You're missing an angle bracket...

> #include <complex>
> #include <boost/python/class.hpp>
> #include <boost/python/module.hpp>
> 
> 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;
>  private:
>   int   _rows;
>   int   _cols;
>   int   _depth;
> };
> }
> 
> using std::complex;
> namespace python = boost::python;
> using namespace SuperCode;
> BOOST_PYTHON_MODULE_INIT(supercode)
> {
>    python::module("supercode")
> 
>    //  ** ComplexArray3 **
> 
>      .add(
>    python::class_<Array3<complex<double> >("ComplexArray3")
HERE--------------------------------------^

>    .def_init(python::args<int,int,int>())
>    .def_init(python::args<const Array3<complex<double> >&>())
>    .def("get", &Array3<complex<double> >::get)
>    )
>      ;
> }

HTH,

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







More information about the Cplusplus-sig mailing list