OpenMP: Fix typo in atomic directive error message
[gcc.git] / libstdc++-v3 / testsuite / 23_containers / unordered_set / pr115285.cc
blob85954aed74b52a7e1ebefd04f7be6181a0809fb2
1 // { dg-do run { target c++11 } }
3 // libstdc++/115285
5 #include <unordered_set>
6 #include <string>
7 #include <vector>
9 #include <testsuite_hooks.h>
11 class TrimmedStr : public std::string
13 static std::string trim_str(std::string const &str)
15 auto start = str.find_first_not_of(" \r\n\t");
17 return start == std::string::npos
18 ? str
19 : str.substr(start, str.find_last_not_of(" \r\n\t") - start + 1);
22 public:
23 TrimmedStr(std::string const &arg)
24 : std::string{trim_str(arg)} {}
25 TrimmedStr(char const *arg)
26 : TrimmedStr{std::string{arg}} {}
29 int main()
31 std::unordered_set<TrimmedStr, std::hash<std::string>, std::equal_to<std::string>>
32 set_from_initializer_list{ "foo", "bar", " foo ", " bar " };
34 VERIFY( set_from_initializer_list.size() == 2 );
36 std::vector<std::string> args{ "foo", "bar", " foo ", " bar " };
37 std::unordered_set<TrimmedStr, std::hash<std::string>, std::equal_to<std::string>>
38 set_from_iterators;
39 set_from_iterators.insert(args.begin(), args.end());
40 VERIFY( set_from_iterators.size() == 2 );