Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-10-26 09:27:53

----- Original Message -----
From: "Anton Gluck" <gluc_at_[hidden]>

> But the line
> still gives my problems, because now "const class std::basic_ifstream<..>"
> can't be converted to "class std::basic_ifstream<..>".

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'
interface, you can do something like this:

struct TextRecordIteratorWrapper : TextRecordIterator
   TextRecordIteratorWrapper(std::ifstream* s) :
      TextRecordIterator(*s) {}

text_record_class(ClusterForPython, "TextRecordIterator");
text_record_class.def(&TextRecordIteratorWrapper::function1, "function1");

[Ralf, you should be able to take advantage of this technique for your Tuple
constructor argument problem. I think the problem you had the other day was
that your member function pointers were members of the base class instead of
the derived class. There should be no need to write forwarding functions for
anything other than constructors]

> Another question, about the use of this in Python: Do I understand you
> correctly if I say that this is how it would work in Python:
> >>> inputfilestream = ifstream("filename")
> >>> iterator = TextRecordIterator(inputfilestream)

Yes, exactly.

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