6 Jun
2013
6 Jun
'13
4:35 a.m.
Hi Michel,
2013/6/6 Michel Morin
Akira Takahashi wrote:
My Boost.Range Extension has `front` accessor.
"Range Access" adaptors in your extensions are interesting. For the consistency of range adaptors, shouldn't `front` adaptor return `single` range?
I see. `optional_front` usage is following: if (optional<T> x = r | optional_front()) { std::cout << x.get() << std::endl; } If `front` return signle range, the usage is following: for (T x : x | front) { std::cout << x << std::endl; } If `front` is error, the return value is empty range. I think single range approach is better. However, I think now `front` and `optional_front` is useful. I would like to add `optional_front` and `front_range`. Thanks! Akira