An obvious (naive?) approach would be:
std::set s; for (int i = 0; i < SIZE; ++i) { s.insert(i); }
That\'s reasonable rea
This can be accomplished in a single line of code. The lambda capture can initialize the variable i to 0 and the mutable specifier allows i to be updated within the lambda function:
i
0
generate_n( inserter( s, s.begin() ), SIZE, [ i=0 ]() mutable { return i++; });