tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
variant_fwd.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2021 Tobias Hienzsch
3
4#ifndef TETL_VARIANT_VARIANT_FWD_HPP
5#define TETL_VARIANT_VARIANT_FWD_HPP
6
7#include <etl/_cstddef/size_t.hpp>
8#include <etl/_type_traits/add_const.hpp>
9#include <etl/_type_traits/add_cv.hpp>
10#include <etl/_type_traits/add_pointer.hpp>
11#include <etl/_type_traits/add_volatile.hpp>
12
13namespace etl {
14
15template <typename... Types>
16struct variant;
17
18template <typename... Types>
19struct variant;
20
21template <typename T>
22struct variant_size;
23
24/// \brief Provides compile-time indexed access to the types of the alternatives
25/// of the possibly cv-qualified variant, combining cv-qualifications of the
26/// variant (if any) with the cv-qualifications of the alternative.
27template <size_t I, typename T>
28struct variant_alternative;
29
30template <etl::size_t I, typename... Ts>
31constexpr auto unchecked_get(variant<Ts...>& v) -> auto&;
32
33template <etl::size_t I, typename... Ts>
34constexpr auto unchecked_get(variant<Ts...> const& v) -> auto const&;
35
36template <etl::size_t I, typename... Ts>
37constexpr auto unchecked_get(variant<Ts...>&& v) -> auto&&;
38
39template <etl::size_t I, typename... Ts>
40constexpr auto unchecked_get(variant<Ts...> const&& v) -> auto const&&;
41
42template <typename T, typename... Types>
43constexpr auto get_if(variant<Types...>* pv) noexcept -> add_pointer_t<T>; // NOLINT
44
45template <typename T, typename... Types>
46constexpr auto get_if(variant<Types...> const* pv) noexcept -> add_pointer_t<T const>; // NOLINT
47
48template <size_t I, typename... Types>
49constexpr auto get_if(variant<Types...>* pv) noexcept -> add_pointer_t<typename variant_alternative<
50 I,
51 variant<Types...>
52>::type>; // NOLINT
53
54template <size_t I, typename... Types>
55constexpr auto get_if(variant<Types...> const* pv) noexcept -> add_pointer_t<typename variant_alternative<
56 I,
57 variant<Types...>
58>::type const>; // NOLINT
59
60} // namespace etl
61
62#endif // TETL_VARIANT_VARIANT_FWD_HPP
Definition adjacent_find.hpp:9
constexpr auto unchecked_get(variant< Ts... > const &&v) -> auto const &&
constexpr auto unchecked_get(variant< Ts... > &v) -> auto &
constexpr auto unchecked_get(variant< Ts... > &&v) -> auto &&
constexpr auto unchecked_get(variant< Ts... > const &v) -> auto const &
constexpr auto get_if(variant< Types... > *pv) noexcept -> add_pointer_t< T >
constexpr auto get_if(variant< Types... > const *pv) noexcept -> add_pointer_t< T const >
Definition variant.hpp:99
constexpr auto get_if(variant< Ts... > *pv) noexcept -> add_pointer_t< variant_alternative_t< I, variant< Ts... > > >
If pv is not a null pointer and pv->index() == I, returns a pointer to the value stored in the varian...
Definition variant.hpp:454
constexpr auto get_if(variant< Ts... > const *pv) noexcept -> add_pointer_t< variant_alternative_t< I, variant< Ts... > > const >
If pv is not a null pointer and pv->index() == I, returns a pointer to the value stored in the varian...
Definition variant.hpp:468