Boost logo

Boost :

From: Anton Gluck (gluc_at_[hidden])
Date: 2000-11-01 02:02:18


Dave,

> I just downloaded the project to a fresh directory and everything worked,
> but I think that's because I checked an MSVC bug workaround into boost a few
> days ago which hasn't made it into a release yet. You can get the fix at:
>
> http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/boost/boost/detail/ob_type_tra
> its.hpp?cvsroot=boost

Yessss - that did it. However: There's still a problem with my own wrapper
code. If you remember, you told me earlier to wrap std::ifstream as if it
were a class of my own so that I could use it as a parameter for my
TextRecordIterator (the constructor is TextRecordIterator(std::ifstream&
inputData)). This works well with the older version of py_cpp, but with
the new version it gives me these errors:

d:\py_cpp/init_function.h(188) : error C2665: 'from_python' : none of the
123 overloads can convert parameter 2 from type 'struct py::Type<char
const * const &>'
        d:\py_cpp/init_function.h(183) : while compiling class-template
member function 'class py::InstanceHolderBase *__thiscall py::Init1<class
py::InstanceValueHolder<class std::basic_ifstream<char,struct
std::char_traits<char> >,class py::HeldInstance<class
std::basic_ifstream<char,struct std::char_traits<char> > >
>,char const * const &>::create_holder(class py::ExtensionInstance
*,struct _object *,struct _object *) const'
d:\py_cpp/init_function.h(189) : error C2661: 'InstanceValueHolder<class
std::basic_ifstream<char,struct std::char_traits<char> >,class
py::HeldInstance<class std::basic_ifstream<char,struct
std::char_traits<char> > > >::InstanceValueHolder<class
std::basic_ifstream<char,struct std::char_traits<char> >,class
py::HeldInstance<class std::basic_ifstream<char,struct
std::char_traits<char> > > >' : no overloaded function takes 2 parameters
        d:\py_cpp/init_function.h(183) : while compiling class-template
member function 'class py::InstanceHolderBase *__thiscall py::Init1<class
py::InstanceValueHolder<class std::basic_ifstream<char,struct
std::char_traits<char> >,class py::HeldInstance<class
std::basic_ifstream<char,struct std::char_traits<char> > >
>,char const * const &>::create_holder(class py::ExtensionInstance
*,struct _object *,struct _object *) const'

This here is the relevant code - I hope it is enough for you to test this:

py::ClassWrapper<std::ifstream> ifstream_class(ClusterForPy, "ifstream");
ifstream_class.def(py::Constructor<const char*>());
(there is also a #include <fstream>)

(The same error also happens if I use
ifstream_class.def(py::Constructor<std::string*>());)

Interestingly, if I take out the ifstream lines, I'm getting very similar
errors with other lines (the error messages always involve some const & or
another).

Sorry for the continuing troubles...

Toni


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk