iterator adaptor (complex->real)

I've been using an iterator adaptor to reinterpret between vectors of scalar
and vectors of complex. Problem is, it relies on
real(z)
returning an lvalue. This is true in current gnu libstdc++, but looks like
it's not in the current standard, and appears to be going away (real(z) will
return rvalue).
I need some help fixing this code in my complex_to_real iterator adaptor:
template<typename BaseIterator>
class const_c_to_r_adapt : public boost::iterator_adaptor<
const_c_to_r_adapt<BaseIterator>,
BaseIterator,
typename std::iterator_traits<BaseIterator>::value_type::value_type,
use_default,
typename std::iterator_traits<BaseIterator>::value_type::value_type
...
scalar_type & dereference() const {
return (cnt % 2 == 0) ? real (const_cast
base_reference())) : imag (const_cast
(*this- base_reference())); }
Changing it to return an rvalue is not acceptable. I need the functionality of returning an lvalue. Any ideas?
participants (1)
-
Neal Becker