CVB++ 15.0
stdvariant.hpp
1#pragma once
2
8
9#include "stdver.hpp"
10
11#if CVB_HAS_CPP2017
12# if defined __has_include && __has_include(<variant>)
13# define CVB_HAS_STDVARIANT
14# endif
15#endif
16
17#ifdef CVB_HAS_STDVARIANT
18
19# include <variant>
20
21namespace Cvb
22{
23 using std::bad_variant_access;
24 using std::get;
25 using std::get_if;
26 using std::holds_alternative;
27 using std::monostate;
28 using std::variant;
29 using std::variant_alternative;
30 using std::variant_npos;
31 using std::variant_size;
32 using std::visit;
33} // namespace Cvb
34
35#else
36
37# include "../shims/variant.hpp"
38
39namespace Cvb
40{
42 using Shims::get;
43 using Shims::get_if;
45 using Shims::monostate;
46 using Shims::variant;
50 using Shims::visit;
51} // namespace Cvb
52
53#endif
Error when accessing not set alternative.
Definition variant.hpp:26
This class is a replacement for C++17 std::variant.
Definition variant.hpp:49
auto visit(VISITOR &&visitor, VARIANT &&var) -> decltype(visitor(get< 0 >(var)))
Visits the given Shims::variant var. Cvb::Shims::visit can only visit one variant (not multiple like ...
Definition variant.hpp:622
const variant_alternative_t< I, variant< TS... > > & get(const variant< TS... > &var)
Gets the value of the given Shims::variant var as the alternative with index I.
Definition variant.hpp:382
bool holds_alternative(const variant< TS... > &var) noexcept
Gets whether the Shims::variant var holds an instance of type T.
Definition variant.hpp:567
static const constexpr size_t variant_npos
Returned by variant::index() on invalid state.
Definition variant.hpp:33
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
Unit type intended for use as a well-behaved empty alternative in Shims::variant.
Definition variant.hpp:237
Compile-time index access to the type of the alternatives at index I.
Definition variant.hpp:41
Get the number of alternatives in a variant.
Definition variant.hpp:327