Lines Matching refs:std

16 static inline void hash_combine(std::size_t &) noexcept { }  in hash_combine()
19 static inline void hash_combine(std::size_t &seed, const T &v, Rest &&...rest) noexcept in hash_combine()
21 std::hash<T> hasher; in hash_combine()
23 hash_combine(seed, std::forward<Rest>(rest)...); in hash_combine()
27 namespace std \
31 std::size_t operator()(const type &t) const noexcept \
33 std::size_t ret = 0; \
40 using pair_type = std::pair<int, double>;
54 …bool operator<(const Foo &other) const noexcept { return std::tie(x, y) < std::tie(other.x, other.… in operator <()
56 PetscErrorCode to_string(std::string &buf) const noexcept in to_string()
59 PetscCallCXX(buf = std::to_string(x) + ", " + std::to_string(y)); in to_string()
63 friend std::ostream &operator<<(std::ostream &oss, const Foo &f) noexcept in operator <<()
65 std::string ret; in operator <<()
77 std::vector<int> x{};
78 std::string y{};
81 Bar(std::vector<int> x, std::string y) noexcept : x(std::move(x)), y(std::move(y)) { } in Bar()
84 …bool operator<(const Bar &other) const noexcept { return std::tie(x, y) < std::tie(other.x, other.… in operator <()
86 PetscErrorCode to_string(std::string &buf) const noexcept in to_string()
90 for (std::size_t i = 0; i < x.size(); ++i) { in to_string()
91 PetscCallCXX(buf += std::to_string(x[i])); in to_string()
98 friend std::ostream &operator<<(std::ostream &oss, const Bar &b) noexcept in operator <<()
100 std::string ret; in operator <<()
111 constexpr std::size_t operator()(const T &) const noexcept in operator ()()
119 using signature = PetscErrorCode(const T &, std::string &);
121 mutable std::string buffer;
122 std::function<signature> printer;
125 Printer(F &&printer) noexcept : printer(std::forward<F>(printer)) in Printer()
170 const std::string map_name;
173 std::function<value_type(void)> generator;
177 std::ostringstream oss; in view_map()
180 PetscCallCXX(oss << std::boolalpha); in view_map()
217 …PetscErrorCode check_size_capacity_coherent(map_type &map, std::size_t expected_size, std::size_t … in check_size_capacity_coherent()
234 using insert_return_type = std::pair<typename map_type::iterator, bool>; in test_insert()
239 const auto pair = std::make_pair(key_const, value_const); in test_insert()
254 …PetscCall(CHECK_REINSERT(map.emplace(std::piecewise_construct, std::make_tuple(key), std::make_tup… in test_insert()
255 PetscCall(CHECK_REINSERT(map.insert(std::make_pair(key, value)))); in test_insert()
283 …o test_map_contains_expected_items = [&](std::function<PetscErrorCode(std::vector<value_type> &)> … in test_insert()
285 std::vector<std::size_t> found_key_value(key_value_pairs.size()); in test_insert()
295 PetscCallCXX(std::sort(key_value_pairs.begin(), key_value_pairs.end())); in test_insert()
298 const auto found = std::lower_bound(kv_begin, key_value_pairs.cend(), *it); in test_insert()
299 const auto dist = std::distance(kv_begin, found); in test_insert()
303 … this->key_printer(it->first), this->value_printer(it->second), static_cast<std::ptrdiff_t>(dist)); in test_insert()
305 PetscCallCXX(++found_key_value.at(static_cast<std::size_t>(dist))); in test_insert()
309 for (std::size_t i = 0; i < found_key_value.size(); ++i) { in test_insert()
318 [&](std::vector<value_type> &key_value_pairs) in test_insert()
339 [&](std::vector<value_type> &key_value_pairs) in test_insert()
345 …PetscCallCXX(std::copy(key_value_pairs.cbegin(), key_value_pairs.cend(), std::inserter(map, map.be… in test_insert()
392 const auto range_size = std::distance(range_begin, range.second); in test_find()
460 std::size_t cap_before; in test_erase()
493 using std::swap; in test_erase()
503 std::copy(sample_values.cbegin(), sample_values.cend(), std::inserter(map, map.begin())); in test_erase()
522 constexpr std::size_t max_iter = 10000; in test_iterators()
523 constexpr auto is_normal = std::is_same<It, typename map_type::iterator>::value; in test_iterators()
524 constexpr auto is_const = std::is_same<It, typename map_type::const_iterator>::value; in test_iterators()
539 std::size_t i; in test_iterators()
556 PetscCallCXX(it = std::prev(map.end())); in test_iterators()
562 PetscCallCXX(it = std::prev(map.end())); in test_iterators()
601 auto moved_copy = std::move(map_copy); in test_misc()
626 PETSC_NODISCARD std::vector<value_type> make_key_values(std::size_t size = 100) const noexcept in make_key_values()
628 std::vector<value_type> v(size); in make_key_values()
630 std::generate(v.begin(), v.end(), this->generator); in make_key_values()
641 return {vwr, name, std::forward<Args>(args)...}; in make_tester()
658 const auto int_printer = [](int key, std::string &buf) { in main()
660 PetscCallCXX(buf = std::to_string(key)); in main()
663 const auto double_printer = [](double value, std::string &buf) { in main()
665 PetscCallCXX(buf = std::to_string(value)); in main()
668 const auto foo_printer = [](const Foo &key, std::string &buf) { in main()
673 const auto bar_printer = [](const Bar &value, std::string &buf) { in main()
678 const auto pair_printer = [](const std::pair<int, double> &value, std::string &buf) { in main()
680 … PetscCallCXX(buf = '<' + std::to_string(value.first) + ", " + std::to_string(value.second) + '>'); in main()
705 constexpr std::size_t max_size = 14, min_size = 1; in main()
706 const auto isize = std::abs(make_int()); in main()
707 std::vector<int> x(std::max(static_cast<std::size_t>(isize) % max_size, min_size)); in main()
710 PetscCallCXXAbort(PETSC_COMM_SELF, std::generate(x.begin(), x.end(), make_int)); in main()
711 auto ret = Bar{std::move(x), std::to_string(isize)}; in main()
715 const auto int_double_generator = [&] { return std::make_pair(make_int(), make_double()); }; in main()
719 const auto int_foo_generator = [&] { return std::make_pair(make_int(), make_foo()); }; in main()
722 const auto foo_bar_generator = [&] { return std::make_pair(make_foo(), make_bar()); }; in main()
729 auto pair = std::make_pair(make_int(), make_double()); in main()
730 return std::make_pair(pair, pair); in main()
732 …PetscCall(make_tester<std::pair<int, double>, std::pair<int, double>>(vwr, "pair<int, double>-pair… in main()
733 …PetscCall(make_tester<std::pair<int, double>, std::pair<int, double>, BadHash>(vwr, "pair<int, dou… in main()