5 Jun
2013
5 Jun
'13
12:50 p.m.
I'd like to suggest the addition of a default value to the range access adaptors. Either by adding it as an extra, non-necessary parameter for the functions, or by duplicating the functions as "front_or_default(T default value)". For example it would be useful for finding objects which I am not sure exists in a range. std::vector<int> vec = boost::assign::list_of(2)(4)(6); auto first_odd = vec | filtered(is_odd) | front(); // undefined? auto first_odd = vec | filtered(is_odd) | front_or_default(-1); // everything is fine! Another option would be a function which returns the adress, or nullptr if the value does not exist? /Viktor