Boost logo

Boost :

From: nbecker_at_[hidden]
Date: 2001-04-05 08:44:41

I am interested in an iterator adaptor that can interface between
containers of complex types and algorithms expecting scalar types, and

I am looking at using iterator_adaptor for this purpose.

One problem I've encountered is what to do with:

Reference dereference(type<Reference>, const BaseIterator& i) const

For example, if you are adapting a complex container extracting the
real part, you can't get a reference to it. I guess the only choice
would be to return a proxy object that overloads assignment?

This brings us to another point. I believe it's a mistake that real()
and imag() of complex don't return a reference. This makes a lot of
things (like this current example) a lot harder.

The argument I've heard is that complex should be an opaque type to
allow for alternative data representations, such as polar.

IMHO, no one is ever going to use this flexibility, and the price for
it is too high. Instead, I believe we should accept that complex is
defined as a cartesian pair.

Another argument for this is the conversion of old code (C or FORTRAN)
which generally expect assignments like:

z.real = blah

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