28 Mar
2017
28 Mar
'17
8:04 p.m.
std::vector<int> buf=s.get_data(); // move, s becomes empty for(...)buf.push_back(...); // populate s.accept_data(buf); // move and sort
I like this idea -- but I don't think accept_data can do the sort because sort might not be enough; the contents might need to be made unique too. We could add the call to unique inside accept_data, but that pessimises the case where I know my data is unique. So I think it would need to be more like; std::vector<int> buf=move(s).get_data(); for(...) buf.push_back(...); // populate sort(buf); unique(buf); // If my contents might not be unique. s.adopt_ordered_unique_data(move(buf)); // Asserts data is in fact ordered and unique? -- chris