1// Copyright (C) 2023 Christian Mazakas
2// Distributed under the Boost Software License, Version 1.0. (See accompanying
3// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
5#ifndef BOOST_UNORDERED_DETAIL_FOA_FLAT_SET_TYPES_HPP
6#define BOOST_UNORDERED_DETAIL_FOA_FLAT_SET_TYPES_HPP
7
8#include <boost/core/allocator_access.hpp>
9
10namespace boost {
11 namespace unordered {
12 namespace detail {
13 namespace foa {
14 template <class Key> struct flat_set_types
15 {
16 using key_type = Key;
17 using init_type = Key;
18 using value_type = Key;
19
20 static Key const& extract(value_type const& key) { return key; }
21
22 using element_type = value_type;
23
24 static Key& value_from(element_type& x) { return x; }
25
26 static element_type&& move(element_type& x) { return std::move(x); }
27
28 template <class A, class... Args>
29 static void construct(A& al, value_type* p, Args&&... args)
30 {
31 boost::allocator_construct(al, p, std::forward<Args>(args)...);
32 }
33
34 template <class A> static void destroy(A& al, value_type* p) noexcept
35 {
36 boost::allocator_destroy(al, p);
37 }
38 };
39 } // namespace foa
40 } // namespace detail
41 } // namespace unordered
42} // namespace boost
43
44#endif // BOOST_UNORDERED_DETAIL_FOA_FLAT_SET_TYPES_HPP
45

source code of boost/libs/unordered/include/boost/unordered/detail/foa/flat_set_types.hpp