104 static constexpr uint64_t TYPE_SIZE { std::max({
sizeof(Types)... }) };
106 static constexpr uint64_t TYPE_ALIGNMENT { std::max({
alignof(Types)... }) };
121 template <uint64_t N, typename... CTorArguments>
131 template <typename T, typename... CTorArguments>
137 template <typename T,
138 typename = std::enable_if_t<!std::is_same<std::decay_t<T>,
variant>::value>,
139 typename std::enable_if_t<!
internal::is_in_place_index<std::decay_t<T>>::value,
bool> = false,
140 typename std::enable_if_t<!
internal::is_in_place_type<std::decay_t<T>>::value,
bool> = false>
179 template <typename T>
182 typename std::enable_if<!std::is_same<T,
variant<Types...>&>::value,
variant<Types...>>::type&
183 operator=(T&& rhs) noexcept;
190 template <uint64_t TypeIndex, typename... CTorArguments>
197 template <typename T, typename... CTorArguments>
198 void emplace(CTorArguments&&... args) noexcept;
209 template <uint64_t TypeIndex>
218 template <uint64_t TypeIndex>
230 template <uint64_t TypeIndex>
239 template <uint64_t TypeIndex>
240 const typename
internal::get_type_at_index<0, TypeIndex, Types...>::type*
248 template <typename T>
249 const T*
get() const noexcept;
256 template <typename T>
262 template <typename T>
270 template <typename T>
271 const T*
get_if(const T* defaultValue) const noexcept;
276 constexpr uint64_t
index() const noexcept;
280 struct alignas(TYPE_ALIGNMENT) storage_t {
284 char data[TYPE_SIZE];
286 storage_t m_storage {};
290 template <
typename T>
291 bool has_bad_variant_element_access() const noexcept;
293 static
void error_message(const
char* source, const
char* msg) noexcept;
295 void call_element_destructor() noexcept;
297 template <typename... Ts>
298 friend constexpr
bool operator==(const
variant<Ts...>& lhs, const
variant<Ts...>& rhs) noexcept;
299 template <typename... Ts>
300 friend constexpr
bool operator!=(const
variant<Ts...>& lhs, const
variant<Ts...>& rhs) noexcept;
internal::get_type_at_index< 0, TypeIndex, Types... >::type * get_at_index() noexcept
returns a pointer to the type stored at index TypeIndex. (not stl compliant)