
Neil Groves skrev:
On Mon, May 10, 2010 at 2:35 AM, Denis Taniguchi
mailto:taniguchi@tpn.usp.br> wrote: Hi,
I was trying to compile the following simple piece of code:
#include
#include #include <vector>
int main(int argc, char *argv[]) { std::vector<int> vec(10); boost::fill(vec | boost::adaptors::reversed, 1);
return 0; }
But I get the following erros with gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3: Am I missing something here?
We shall ignore that there is no reason to use "reversed" here.
The reason this will not compile is that 'vec | boost::adaptors::reversed' returns an unnamed temporary which is then attempted to be passed to the fill function. On many versions of Visual C++ this actually will compile and work as you intended due to a language extension, but this is non-standard.
Does make_reverse_range(rng) not use iterator_range rather than sub_range? Also, I don't see any reason why a const T& overload of boost::fill cannot exists as long as the const-iterator is actually a mutable iterator (like with iterator_range<MutableRange>). -Thorsten