s*****n 发帖数: 994 | 1 std::set s1, s2;
// Fill in s1 and s2 with values
std::set result;
std::set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), result.begin());
And why have to do this?
std::set s1, s2;
// Fill in s1 and s2 with values
std::set result;
std::set_difference(s1.begin(), s1.end(), s2.begin(), s2.end(),
std::inserter(result, result.end())); | S**I 发帖数: 15689 | 2 the location pointed by result.begin() is read only.
));
【在 s*****n 的大作中提到】 : std::set s1, s2; : // Fill in s1 and s2 with values : std::set result; : std::set_union(s1.begin(), s1.end(), s2.begin(), s2.end(), result.begin()); : And why have to do this? : std::set s1, s2; : // Fill in s1 and s2 with values : std::set result; : std::set_difference(s1.begin(), s1.end(), s2.begin(), s2.end(), : std::inserter(result, result.end()));
|
|