[C++-sig] Re: How to specify a double return type?

brett hartshorn bhartsho at yahoo.com
Tue Mar 23 06:58:09 CET 2004


Thanks Ralf and Nicolas for answering my first question.  boost::noncopyable fixed my problem!

Sadly, dReal is a typedef.  I have tried to make 'thin wrappers' but i am not sure if i'm doing it
right.  Here's an example, Foo is the class i am wrapping, Bar is my thin wrapper.

typedef double dReal;

class Foo {
  public:
    const dReal * getSomething() const {
      return otherFunction();
    }

};
class Bar : public Foo {
  public:
    const double * getSomething() const {
       return Foo::getSomething();
    }
};

// the wrapper

class_<Bar> bar("Bar");
 bar
   .def("getSomething", &Bar::getSomething, return_internal_reference<>())
   ;

The tail end of my errors when compiling:

instantiated from here
/usr/include/boost/python/object/make_instance.hpp:25: error: invalid
   application of `sizeof' to an incomplete type

-brett

>Is dReal a typedef for double or float? If so: Python float are immutable. You
>cannot return pointers to immutable types. Somehow you have to change your
>interface, e.g. through the use of "thin wrappers."
>Please explain in more detail what exactly you want to do; hopefully this will
>lead us to the best solution.
>Ralf

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html




More information about the Cplusplus-sig mailing list