10 #ifndef BOOST_BEAST_DETAIL_VARIANT_HPP 11 #define BOOST_BEAST_DETAIL_VARIANT_HPP 14 #include <boost/assert.hpp> 17 #include <type_traits> 34 typename std::aligned_storage<
40 template<std::
size_t I>
41 using type =
typename std::tuple_element<
42 I , std::tuple<TN...>>::type;
44 template<std::
size_t I>
45 using C = std::integral_constant<std::size_t, I>;
66 i_ = other.move(&buf_, C<0>{});
71 i_ = other.copy(&buf_, C<0>{});
79 i_ = other.move(&buf_, C<0>{});
87 i_ = other.copy(&buf_, C<0>{});
91 template<std::size_t I,
class... Args>
98 std::forward<Args>(args)...);
102 template<std::
size_t I>
106 BOOST_ASSERT(i_ == I);
107 return *
reinterpret_cast< 111 template<std::
size_t I>
115 BOOST_ASSERT(i_ == I);
116 return *
reinterpret_cast< 117 type<I-1
> const*>(&buf_);
130 destroy(C<
sizeof...(TN)>)
135 template<std::
size_t I>
150 move(
void*, C<
sizeof...(TN)>)
155 template<std::
size_t I>
157 move(
void* dest, C<I>)
162 new(dest) T{std::move(get<I+1>())};
167 return move(dest, C<I+1>{});
171 copy(
void*, C<
sizeof...(TN)>)
const 176 template<std::
size_t I>
178 copy(
void* dest, C<I>)
const 183 auto const& t = get<I+1>();
187 return copy(dest, C<I+1>{});
~variant()
Definition: variant.hpp:50
Definition: async_result.hpp:20
variant(variant &&other)
Definition: variant.hpp:64
variant(variant const &other)
Definition: variant.hpp:69
void emplace(Args &&...args)
Definition: variant.hpp:93
variant & operator=(variant &&other)
Definition: variant.hpp:75
std::size_t constexpr max_sizeof()
Definition: type_traits.hpp:71
Definition: variant.hpp:32
void reset()
Definition: variant.hpp:121
unsigned char index() const
Definition: variant.hpp:58
variant & operator=(variant const &other)
Definition: variant.hpp:83