Making a range from a single element?

Is there an utility within Boost.Range (or Range_ex) that allows making a range of Ts from a single T? It seems quite useful and practical. Basically a std::make_pair(&foo, &foo+1) works but requires foo to be an lvalue.

Mathias Gaunard skrev:
Is there an utility within Boost.Range (or Range_ex) that allows making a range of Ts from a single T?
No.
It seems quite useful and practical. Basically a std::make_pair(&foo, &foo+1) works but requires foo to be an lvalue.
I guess this would require yuo to define a custom iterator type thatholds an object by boost::optional<T> where the empty optional denote the end of the iterator. I'd be happy to include a function like make_single_element_range() if you implement it and send it to the dev list. -Thorsten
participants (2)
-
Mathias Gaunard
-
Thorsten Ottosen