
2 Jun
2018
2 Jun
'18
7:35 p.m.
On 6/2/18 2:17 AM, Devika Krishnadas via Boost wrote:
I do not know how relevant this is, but as a competitive programmer, it is our usual practice to use #defines to make our lives easier. For such a case, we use #define all(v) v.begin(),v.end() And now any function call can just be as the following example - sort(all(v)) Or contains(all(v),Val)
I'm sorry if this is irrelevant.
LOL - irrelevance is not a reason to avoid posting here. But this raises another interesting question. How about something like: template<class F, class C> auto range_adaptor(const C & c){ return F(c.begin(), c.end()); } so one could say vector<int> v = ... range_adapt(std::find, v); for any collection type. Robert Ramey