|
Boost Users : |
Subject: [Boost-users] iterator adaptor (complex->real)
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2009-12-23 07:22:21
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<complex_type&>(*this-
>base_reference())) : imag (const_cast<complex_type&>(*this-
>base_reference()));
}
Changing it to return an rvalue is not acceptable. I need the functionality
of returning an lvalue. Any ideas?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net