Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <set>
- #include <vector>
- #include <string>
- #include <map>
- #include <algorithm>
- using namespace std;
- template <typename T>
- vector<T> FindGreaterElements(const set<T>& elements, const T& border) {
- vector<T> res = {};
- auto found = find(begin(elements), end(elements), border);
- if (found != end(elements)) {
- ++found;
- for (auto i = found; i != end(elements); ++i) {
- res.push_back(*i);
- }
- }
- return res;
- }
- int main() {
- //FindGreaterElements(set<int>{1, 5, 7, 8}, 5);
- for (int x : FindGreaterElements(set<int>{1, 5, 7, 8}, 5)) {
- cout << x << " ";
- }
- cout << endl;
- string to_find = "Python";
- cout << FindGreaterElements(set<string>{"C", "C++"}, to_find).size() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement