Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-10 13:45:01


> If std::complex was simply derived from boost::array<T, 2>,
> portable conversions would be immediately possible, and you
> could still provide iterators where they make sense.
>
> To put it in more general terms: encapsulation is a great
> idea, but can backfire if overused (as in std::complex, IMO).

I'm afraid that wouldn't work for you. Since complex<T> is a non-POD type
for example, the compiler is not required to make it possible to portably
convert it to/from a T* via reinterpret_cast

What's needed here is a loosening of the restrictions on what constitutes a
POD.

If you write up an email describing the real-world problems for me, I'd be
happy to post to the C++ extensions reflector.


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