On 10/26/2012 04:15 PM, Paul O. Seidon wrote:

> Yes, I have to provide a TYPE to the tempate to enable the compiler to 
> generate code. Isn't 
>
> typedef _Variable<double>  VariableDouble;
>
> BOOST_PYTHON_MODULE(_varbls)
> {
>
>     class_<VariableDouble>("VariableDouble")
>         .def( init<>())
>         .def( init<const double&>())
>     ;
> }
>
> doing that?

The compiler can only generate code from templates it can see at the
point where the instantiation happens. Since in the snippet above it
doesn't see the _Variable constructor definition, it can't instantiate
it. And at the point where it can see the constructor, it doesn't know
that it needs to instantiate it for type 'double'.

The entire issue disappears if you move your member function definitions
(including the constructor) from varbls.cpp to varbls.h.

    Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to