Boost logo

Boost :

From: Anton Gluck (gluc_at_[hidden])
Date: 2000-10-26 23:48:20

> Actually not. It's complaining that you're trying to bind a non-const
> ifstream reference to a const ifstream object. It's a const-correctness
> issue, and it's /my/ bug. I'm working on a fix. In the meantime, I think the
> best you can do is to arrange for a constructor which takes a pointer to an
> ifstream as a parameter. If you don't want to intrude on your class'

I have tried adding a second constructor, but am still getting an error
from py_cpp:

d:\py_cpp/extclass.h(475) : error C2664: '__thiscall
std::basic_ifstream<char,struct std::char_traits<char> > &)' : cannot
convert parameter 1 from 'class std::basic_ifstream<char,struct
std::char_traits<char> > *const ' to 'class std::basic_ifstream<char,struct
std::char_traits<char> > &'

Is this part of the same bug, since it again involves const and non-const

> ifstream as a parameter. If you don't want to intrude on your class'
> interface, you can do something like this:
> struct TextRecordIteratorWrapper : TextRecordIterator
> {
> TextRecordIteratorWrapper(std::ifstream* s) :
> TextRecordIterator(*s) {}
> };
> ...
> py::ClassWrapper<TextRecordIteratorWrapper>
> text_record_class(ClusterForPython, "TextRecordIterator");
> text_record_class.def(py::Constructor<std::ifstream*>());
> text_record_class.def(&TextRecordIteratorWrapper::function1, "function1");
> ...

I _think_ that this worked, but can't be sure yet: The underlying dll has
been changed enough that I can't link my wrapper module with or without
the TextRecordIterator. But at least I don't see any errors coming from
the TextRecordIterator or its wrapper.

Thanks for your help,


Boost list run by bdawes at, gregod at, cpdaniel at, john at