catboost 1.25.1 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DEPLOYMENT.md +22 -15
- package/README.md +37 -27
- package/binding.gyp +5 -7
- package/build_scripts/bootstrap.js +2 -1
- package/build_scripts/out/build.js +46 -68
- package/build_scripts/out/build_model.js +1 -1
- package/build_scripts/out/{build_ya.js → build_native.js} +1 -1
- package/build_scripts/out/ci.js +5 -5
- package/build_scripts/out/config.js +32 -18
- package/build_scripts/out/install.js +5 -3
- package/build_scripts/out/package_prepublish.js +1 -1
- package/build_scripts/out/packaging.js +1 -19
- package/build_scripts/out/run_tests.js +1 -1
- package/build_scripts/out/test.js +8 -3
- package/config.json +18 -11
- package/inc/catboost/libs/model_interface/c_api.h +349 -3
- package/lib/catboost.d.ts +65 -21
- package/package.json +4 -4
- package/src/api_helpers.cpp +100 -24
- package/src/api_helpers.h +8 -7
- package/src/api_module.cpp +1 -2
- package/src/model.cpp +483 -83
- package/src/model.h +24 -9
- package/inc/contrib/libs/cxxsupp/system_stl/include/stlfwd +0 -14
- package/inc/util/charset/recode_result.h +0 -9
- package/inc/util/charset/unicode_table.h +0 -123
- package/inc/util/charset/unidata.h +0 -421
- package/inc/util/charset/utf8.h +0 -384
- package/inc/util/charset/wide.h +0 -843
- package/inc/util/charset/wide_specific.h +0 -22
- package/inc/util/datetime/base.h +0 -669
- package/inc/util/datetime/constants.h +0 -7
- package/inc/util/datetime/cputimer.h +0 -124
- package/inc/util/datetime/parser.h +0 -292
- package/inc/util/datetime/systime.h +0 -47
- package/inc/util/datetime/uptime.h +0 -8
- package/inc/util/digest/city.h +0 -88
- package/inc/util/digest/fnv.h +0 -73
- package/inc/util/digest/multi.h +0 -14
- package/inc/util/digest/murmur.h +0 -57
- package/inc/util/digest/numeric.h +0 -86
- package/inc/util/digest/sequence.h +0 -48
- package/inc/util/draft/date.h +0 -129
- package/inc/util/draft/datetime.h +0 -184
- package/inc/util/draft/enum.h +0 -136
- package/inc/util/draft/holder_vector.h +0 -102
- package/inc/util/draft/ip.h +0 -131
- package/inc/util/draft/matrix.h +0 -108
- package/inc/util/draft/memory.h +0 -40
- package/inc/util/folder/dirent_win.h +0 -46
- package/inc/util/folder/dirut.h +0 -121
- package/inc/util/folder/filelist.h +0 -81
- package/inc/util/folder/fts.h +0 -108
- package/inc/util/folder/iterator.h +0 -109
- package/inc/util/folder/lstat_win.h +0 -20
- package/inc/util/folder/path.h +0 -225
- package/inc/util/folder/pathsplit.h +0 -113
- package/inc/util/folder/tempdir.h +0 -42
- package/inc/util/generic/adaptor.h +0 -134
- package/inc/util/generic/algorithm.h +0 -765
- package/inc/util/generic/array_ref.h +0 -282
- package/inc/util/generic/array_size.h +0 -24
- package/inc/util/generic/benchmark/vector_count_ctor/f.h +0 -9
- package/inc/util/generic/bitmap.h +0 -1115
- package/inc/util/generic/bitops.h +0 -459
- package/inc/util/generic/bt_exception.h +0 -24
- package/inc/util/generic/buffer.h +0 -232
- package/inc/util/generic/cast.h +0 -176
- package/inc/util/generic/deque.h +0 -24
- package/inc/util/generic/explicit_type.h +0 -42
- package/inc/util/generic/fastqueue.h +0 -55
- package/inc/util/generic/flags.h +0 -244
- package/inc/util/generic/function.h +0 -103
- package/inc/util/generic/fwd.h +0 -171
- package/inc/util/generic/guid.h +0 -61
- package/inc/util/generic/hash.h +0 -2032
- package/inc/util/generic/hash_primes.h +0 -140
- package/inc/util/generic/hash_set.h +0 -490
- package/inc/util/generic/hide_ptr.h +0 -3
- package/inc/util/generic/intrlist.h +0 -876
- package/inc/util/generic/is_in.h +0 -53
- package/inc/util/generic/iterator.h +0 -137
- package/inc/util/generic/iterator_range.h +0 -105
- package/inc/util/generic/lazy_value.h +0 -66
- package/inc/util/generic/list.h +0 -22
- package/inc/util/generic/map.h +0 -44
- package/inc/util/generic/mapfindptr.h +0 -60
- package/inc/util/generic/maybe.h +0 -713
- package/inc/util/generic/maybe_traits.h +0 -164
- package/inc/util/generic/mem_copy.h +0 -55
- package/inc/util/generic/noncopyable.h +0 -38
- package/inc/util/generic/object_counter.h +0 -53
- package/inc/util/generic/ptr.h +0 -1113
- package/inc/util/generic/queue.h +0 -57
- package/inc/util/generic/refcount.h +0 -162
- package/inc/util/generic/reserve.h +0 -11
- package/inc/util/generic/scope.h +0 -65
- package/inc/util/generic/serialized_enum.h +0 -406
- package/inc/util/generic/set.h +0 -42
- package/inc/util/generic/singleton.h +0 -136
- package/inc/util/generic/size_literals.h +0 -65
- package/inc/util/generic/stack.h +0 -18
- package/inc/util/generic/store_policy.h +0 -120
- package/inc/util/generic/strbase.h +0 -612
- package/inc/util/generic/strbuf.h +0 -552
- package/inc/util/generic/strfcpy.h +0 -17
- package/inc/util/generic/string.h +0 -1572
- package/inc/util/generic/string_hash.h +0 -21
- package/inc/util/generic/string_ut.h +0 -1175
- package/inc/util/generic/type_name.h +0 -34
- package/inc/util/generic/typelist.h +0 -114
- package/inc/util/generic/typetraits.h +0 -325
- package/inc/util/generic/utility.h +0 -132
- package/inc/util/generic/va_args.h +0 -400
- package/inc/util/generic/variant.h +0 -631
- package/inc/util/generic/variant_traits.h +0 -171
- package/inc/util/generic/vector.h +0 -119
- package/inc/util/generic/xrange.h +0 -258
- package/inc/util/generic/yexception.h +0 -212
- package/inc/util/generic/yexception_ut.h +0 -14
- package/inc/util/generic/ylimits.h +0 -92
- package/inc/util/generic/ymath.h +0 -206
- package/inc/util/memory/addstorage.h +0 -93
- package/inc/util/memory/alloc.h +0 -27
- package/inc/util/memory/blob.h +0 -296
- package/inc/util/memory/mmapalloc.h +0 -8
- package/inc/util/memory/pool.h +0 -432
- package/inc/util/memory/segmented_string_pool.h +0 -194
- package/inc/util/memory/segpool_alloc.h +0 -118
- package/inc/util/memory/smallobj.h +0 -141
- package/inc/util/memory/tempbuf.h +0 -111
- package/inc/util/network/address.h +0 -136
- package/inc/util/network/endpoint.h +0 -61
- package/inc/util/network/hostip.h +0 -16
- package/inc/util/network/init.h +0 -60
- package/inc/util/network/interface.h +0 -17
- package/inc/util/network/iovec.h +0 -65
- package/inc/util/network/ip.h +0 -116
- package/inc/util/network/nonblock.h +0 -8
- package/inc/util/network/pair.h +0 -9
- package/inc/util/network/poller.h +0 -58
- package/inc/util/network/pollerimpl.h +0 -707
- package/inc/util/network/sock.h +0 -608
- package/inc/util/network/socket.h +0 -421
- package/inc/util/random/common_ops.h +0 -130
- package/inc/util/random/easy.h +0 -47
- package/inc/util/random/entropy.h +0 -21
- package/inc/util/random/fast.h +0 -101
- package/inc/util/random/init_atfork.h +0 -3
- package/inc/util/random/lcg_engine.h +0 -66
- package/inc/util/random/mersenne.h +0 -46
- package/inc/util/random/mersenne32.h +0 -50
- package/inc/util/random/mersenne64.h +0 -50
- package/inc/util/random/normal.h +0 -38
- package/inc/util/random/random.h +0 -30
- package/inc/util/random/shuffle.h +0 -39
- package/inc/util/str_stl.h +0 -266
- package/inc/util/stream/aligned.h +0 -99
- package/inc/util/stream/buffer.h +0 -119
- package/inc/util/stream/buffered.h +0 -225
- package/inc/util/stream/debug.h +0 -53
- package/inc/util/stream/direct_io.h +0 -43
- package/inc/util/stream/file.h +0 -108
- package/inc/util/stream/format.h +0 -444
- package/inc/util/stream/fwd.h +0 -100
- package/inc/util/stream/hex.h +0 -8
- package/inc/util/stream/holder.h +0 -44
- package/inc/util/stream/input.h +0 -273
- package/inc/util/stream/labeled.h +0 -19
- package/inc/util/stream/length.h +0 -100
- package/inc/util/stream/mem.h +0 -255
- package/inc/util/stream/multi.h +0 -32
- package/inc/util/stream/null.h +0 -61
- package/inc/util/stream/output.h +0 -304
- package/inc/util/stream/pipe.h +0 -112
- package/inc/util/stream/printf.h +0 -25
- package/inc/util/stream/str.h +0 -207
- package/inc/util/stream/tee.h +0 -28
- package/inc/util/stream/tempbuf.h +0 -21
- package/inc/util/stream/tokenizer.h +0 -214
- package/inc/util/stream/trace.h +0 -60
- package/inc/util/stream/walk.h +0 -35
- package/inc/util/stream/zerocopy.h +0 -91
- package/inc/util/stream/zerocopy_output.h +0 -57
- package/inc/util/stream/zlib.h +0 -173
- package/inc/util/string/ascii.h +0 -236
- package/inc/util/string/builder.h +0 -39
- package/inc/util/string/cast.h +0 -347
- package/inc/util/string/cstriter.h +0 -14
- package/inc/util/string/escape.h +0 -70
- package/inc/util/string/hex.h +0 -59
- package/inc/util/string/join.h +0 -194
- package/inc/util/string/printf.h +0 -13
- package/inc/util/string/reverse.h +0 -16
- package/inc/util/string/split.h +0 -1080
- package/inc/util/string/strip.h +0 -257
- package/inc/util/string/strspn.h +0 -65
- package/inc/util/string/subst.h +0 -56
- package/inc/util/string/type.h +0 -50
- package/inc/util/string/util.h +0 -195
- package/inc/util/string/vector.h +0 -132
- package/inc/util/system/align.h +0 -50
- package/inc/util/system/atexit.h +0 -22
- package/inc/util/system/atomic.h +0 -51
- package/inc/util/system/atomic_gcc.h +0 -90
- package/inc/util/system/atomic_ops.h +0 -189
- package/inc/util/system/atomic_win.h +0 -114
- package/inc/util/system/backtrace.h +0 -39
- package/inc/util/system/byteorder.h +0 -186
- package/inc/util/system/compat.h +0 -84
- package/inc/util/system/compiler.h +0 -620
- package/inc/util/system/condvar.h +0 -71
- package/inc/util/system/context.h +0 -181
- package/inc/util/system/context_aarch64.h +0 -8
- package/inc/util/system/context_i686.h +0 -9
- package/inc/util/system/context_x86.h +0 -12
- package/inc/util/system/context_x86_64.h +0 -7
- package/inc/util/system/cpu_id.h +0 -159
- package/inc/util/system/daemon.h +0 -28
- package/inc/util/system/datetime.h +0 -98
- package/inc/util/system/defaults.h +0 -149
- package/inc/util/system/demangle.h +0 -5
- package/inc/util/system/demangle_impl.h +0 -23
- package/inc/util/system/direct_io.h +0 -71
- package/inc/util/system/dynlib.h +0 -119
- package/inc/util/system/env.h +0 -32
- package/inc/util/system/error.h +0 -95
- package/inc/util/system/event.h +0 -122
- package/inc/util/system/execpath.h +0 -17
- package/inc/util/system/fasttime.h +0 -6
- package/inc/util/system/fhandle.h +0 -27
- package/inc/util/system/file.h +0 -210
- package/inc/util/system/file_lock.h +0 -34
- package/inc/util/system/filemap.h +0 -383
- package/inc/util/system/flock.h +0 -35
- package/inc/util/system/fs.h +0 -156
- package/inc/util/system/fs_win.h +0 -29
- package/inc/util/system/fstat.h +0 -46
- package/inc/util/system/getpid.h +0 -12
- package/inc/util/system/guard.h +0 -179
- package/inc/util/system/hi_lo.h +0 -139
- package/inc/util/system/hostname.h +0 -10
- package/inc/util/system/hp_timer.h +0 -36
- package/inc/util/system/info.h +0 -12
- package/inc/util/system/interrupt_signals.h +0 -22
- package/inc/util/system/madvise.h +0 -30
- package/inc/util/system/maxlen.h +0 -32
- package/inc/util/system/mem_info.h +0 -18
- package/inc/util/system/mincore.h +0 -38
- package/inc/util/system/mktemp.h +0 -11
- package/inc/util/system/mlock.h +0 -43
- package/inc/util/system/mutex.h +0 -67
- package/inc/util/system/nice.h +0 -3
- package/inc/util/system/pipe.h +0 -90
- package/inc/util/system/platform.h +0 -246
- package/inc/util/system/progname.h +0 -13
- package/inc/util/system/protect.h +0 -25
- package/inc/util/system/rusage.h +0 -26
- package/inc/util/system/rwlock.h +0 -78
- package/inc/util/system/sanitizers.h +0 -122
- package/inc/util/system/sem.h +0 -41
- package/inc/util/system/shellcommand.h +0 -472
- package/inc/util/system/shmat.h +0 -32
- package/inc/util/system/sigset.h +0 -78
- package/inc/util/system/spin_wait.h +0 -10
- package/inc/util/system/spinlock.h +0 -121
- package/inc/util/system/src_location.h +0 -25
- package/inc/util/system/src_root.h +0 -68
- package/inc/util/system/sys_alloc.h +0 -43
- package/inc/util/system/sysstat.h +0 -52
- package/inc/util/system/tempfile.h +0 -34
- package/inc/util/system/thread.h +0 -167
- package/inc/util/system/tls.h +0 -307
- package/inc/util/system/types.h +0 -119
- package/inc/util/system/unaligned_mem.h +0 -67
- package/inc/util/system/user.h +0 -5
- package/inc/util/system/utime.h +0 -6
- package/inc/util/system/valgrind.h +0 -48
- package/inc/util/system/winint.h +0 -43
- package/inc/util/system/yassert.h +0 -121
- package/inc/util/system/yield.h +0 -4
- package/inc/util/thread/factory.h +0 -65
- package/inc/util/thread/fwd.h +0 -30
- package/inc/util/thread/lfqueue.h +0 -406
- package/inc/util/thread/lfstack.h +0 -188
- package/inc/util/thread/pool.h +0 -388
- package/inc/util/thread/singleton.h +0 -42
- package/inc/util/ysafeptr.h +0 -427
- package/inc/util/ysaveload.h +0 -700
|
@@ -1,631 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include "variant_traits.h"
|
|
4
|
-
|
|
5
|
-
#include <util/generic/hash.h>
|
|
6
|
-
|
|
7
|
-
template <class T>
|
|
8
|
-
struct TVariantTypeTag {}; // aka std::in_place_type_t
|
|
9
|
-
|
|
10
|
-
template <size_t I>
|
|
11
|
-
struct TVariantIndexTag {}; // aka std::in_place_index_t
|
|
12
|
-
|
|
13
|
-
template <size_t I, class V>
|
|
14
|
-
using TVariantAlternative = ::NVariant::TAlternative<I, V>;
|
|
15
|
-
|
|
16
|
-
template <size_t I, class V>
|
|
17
|
-
using TVariantAlternativeType = ::NVariant::TAlternativeType<I, V>;
|
|
18
|
-
|
|
19
|
-
template <class T, class V>
|
|
20
|
-
struct TVariantIndex;
|
|
21
|
-
|
|
22
|
-
template <class T, class... Ts>
|
|
23
|
-
struct TVariantIndex<T, TVariant<Ts...>> : ::NVariant::TIndexOf<T, Ts...> {};
|
|
24
|
-
|
|
25
|
-
// Since there is now standard metafunction for std::variant,
|
|
26
|
-
// we need template specialization for it
|
|
27
|
-
#if _LIBCPP_STD_VER >= 17
|
|
28
|
-
#include <variant>
|
|
29
|
-
|
|
30
|
-
template <class T, class... Ts>
|
|
31
|
-
struct TVariantIndex<T, std::variant<Ts...>> : ::NVariant::TIndexOf<T, Ts...> {};
|
|
32
|
-
#endif
|
|
33
|
-
|
|
34
|
-
template <class T, class V>
|
|
35
|
-
constexpr size_t TVariantIndexV = TVariantIndex<T, V>::value;
|
|
36
|
-
|
|
37
|
-
template <class V>
|
|
38
|
-
using TVariantSize = ::NVariant::TSize<V>;
|
|
39
|
-
|
|
40
|
-
constexpr size_t TVARIANT_NPOS = ::NVariant::T_NPOS;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
template <class F, class... Ts>
|
|
44
|
-
decltype(auto) Visit(F&& f, TVariant<Ts...>& v);
|
|
45
|
-
|
|
46
|
-
template <class F, class... Ts>
|
|
47
|
-
decltype(auto) Visit(F&& f, const TVariant<Ts...>& v);
|
|
48
|
-
|
|
49
|
-
template <class F, class... Ts>
|
|
50
|
-
decltype(auto) Visit(F&& f, TVariant<Ts...>&& v);
|
|
51
|
-
|
|
52
|
-
template <class F, class... Ts>
|
|
53
|
-
decltype(auto) Visit(F&& f, const TVariant<Ts...>&& v);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
template <class T, class... Ts>
|
|
57
|
-
constexpr bool HoldsAlternative(const TVariant<Ts...>& v) noexcept;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
template <size_t I, class... Ts>
|
|
61
|
-
decltype(auto) Get(TVariant<Ts...>& v);
|
|
62
|
-
|
|
63
|
-
template <size_t I, class... Ts>
|
|
64
|
-
decltype(auto) Get(const TVariant<Ts...>& v);
|
|
65
|
-
|
|
66
|
-
template <size_t I, class... Ts>
|
|
67
|
-
decltype(auto) Get(TVariant<Ts...>&& v);
|
|
68
|
-
|
|
69
|
-
template <size_t I, class... Ts>
|
|
70
|
-
decltype(auto) Get(const TVariant<Ts...>&& v);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
template <class T, class... Ts>
|
|
74
|
-
decltype(auto) Get(TVariant<Ts...>& v);
|
|
75
|
-
|
|
76
|
-
template <class T, class... Ts>
|
|
77
|
-
decltype(auto) Get(const TVariant<Ts...>& v);
|
|
78
|
-
|
|
79
|
-
template <class T, class... Ts>
|
|
80
|
-
decltype(auto) Get(TVariant<Ts...>&& v);
|
|
81
|
-
|
|
82
|
-
template <class T, class... Ts>
|
|
83
|
-
decltype(auto) Get(const TVariant<Ts...>&& v);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
template <size_t I, class... Ts>
|
|
87
|
-
auto* GetIf(TVariant<Ts...>* v) noexcept;
|
|
88
|
-
|
|
89
|
-
template <size_t I, class... Ts>
|
|
90
|
-
const auto* GetIf(const TVariant<Ts...>* v) noexcept;
|
|
91
|
-
|
|
92
|
-
template <class T, class... Ts>
|
|
93
|
-
T* GetIf(TVariant<Ts...>* v) noexcept;
|
|
94
|
-
|
|
95
|
-
template <class T, class... Ts>
|
|
96
|
-
const T* GetIf(const TVariant<Ts...>* v) noexcept;
|
|
97
|
-
|
|
98
|
-
//! |std::variant (c++17)| poor substitute of discriminated union.
|
|
99
|
-
template <class... Ts>
|
|
100
|
-
class TVariant {
|
|
101
|
-
template <class T>
|
|
102
|
-
using TIndex = ::NVariant::TIndexOf<std::decay_t<T>, Ts...>;
|
|
103
|
-
|
|
104
|
-
using T_0 = TVariantAlternativeType<0, TVariant>;
|
|
105
|
-
|
|
106
|
-
static_assert(::NVariant::TTypeTraits<Ts...>::TNoRefs::value,
|
|
107
|
-
"TVariant type arguments cannot be references.");
|
|
108
|
-
static_assert(::NVariant::TTypeTraits<Ts...>::TNoVoids::value,
|
|
109
|
-
"TVariant type arguments cannot be void.");
|
|
110
|
-
static_assert(::NVariant::TTypeTraits<Ts...>::TNoArrays::value,
|
|
111
|
-
"TVariant type arguments cannot be arrays.");
|
|
112
|
-
static_assert(::NVariant::TTypeTraits<Ts...>::TNotEmpty::value,
|
|
113
|
-
"TVariant type list cannot be empty.");
|
|
114
|
-
|
|
115
|
-
public:
|
|
116
|
-
TVariant() noexcept(std::is_nothrow_default_constructible<T_0>::value) {
|
|
117
|
-
static_assert(std::is_default_constructible<T_0>::value,
|
|
118
|
-
"First alternative must be default constructible");
|
|
119
|
-
EmplaceImpl<T_0>();
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
TVariant(const TVariant& rhs) {
|
|
123
|
-
if (!rhs.valueless_by_exception()) {
|
|
124
|
-
ForwardVariant(rhs);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
TVariant(TVariant&& rhs) noexcept(
|
|
129
|
-
TConjunction<std::is_nothrow_move_constructible<Ts>...>::value) {
|
|
130
|
-
if (!rhs.valueless_by_exception()) {
|
|
131
|
-
ForwardVariant(std::move(rhs));
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
template <class T, class = std::enable_if_t<!std::is_same<std::decay_t<T>, TVariant>::value>>
|
|
136
|
-
TVariant(T&& value) {
|
|
137
|
-
EmplaceImpl<T>(std::forward<T>(value));
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
//! Constructs an instance in-place.
|
|
141
|
-
template <class T, class... TArgs>
|
|
142
|
-
explicit TVariant(TVariantTypeTag<T>, TArgs&&... args) {
|
|
143
|
-
EmplaceImpl<T>(std::forward<TArgs>(args)...);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
//! Constructs an instance in-place by index.
|
|
147
|
-
template <size_t I, class... TArgs>
|
|
148
|
-
explicit TVariant(TVariantIndexTag<I>, TArgs&&... args) {
|
|
149
|
-
EmplaceImpl<TVariantAlternativeType<I, TVariant>>(std::forward<TArgs>(args)...);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
~TVariant() {
|
|
153
|
-
Destroy();
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
TVariant& operator=(const TVariant& rhs) {
|
|
157
|
-
if (Y_UNLIKELY(rhs.valueless_by_exception())) {
|
|
158
|
-
if (Y_LIKELY(!valueless_by_exception())) {
|
|
159
|
-
DestroyImpl();
|
|
160
|
-
Index_ = ::TVariantSize<TVariant>::value;
|
|
161
|
-
}
|
|
162
|
-
} else if (index() == rhs.index()) {
|
|
163
|
-
::Visit([&](auto& dst) -> void {
|
|
164
|
-
::Visit([&](const auto& src) -> void {
|
|
165
|
-
::NVariant::CallIfSame<void>([](auto& x, const auto& y) {
|
|
166
|
-
x = y;
|
|
167
|
-
}, dst, src);
|
|
168
|
-
}, rhs);
|
|
169
|
-
}, *this);
|
|
170
|
-
} else {
|
|
171
|
-
// Strong exception guarantee.
|
|
172
|
-
*this = TVariant{rhs};
|
|
173
|
-
}
|
|
174
|
-
return *this;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
TVariant& operator=(TVariant&& rhs) {
|
|
178
|
-
if (Y_UNLIKELY(rhs.valueless_by_exception())) {
|
|
179
|
-
if (Y_LIKELY(!valueless_by_exception())) {
|
|
180
|
-
DestroyImpl();
|
|
181
|
-
Index_ = ::TVariantSize<TVariant>::value;
|
|
182
|
-
}
|
|
183
|
-
} else if (index() == rhs.index()) {
|
|
184
|
-
::Visit([&](auto& dst) -> void {
|
|
185
|
-
::Visit([&](auto& src) -> void {
|
|
186
|
-
::NVariant::CallIfSame<void>([](auto& x, auto& y) {
|
|
187
|
-
x = std::move(y);
|
|
188
|
-
}, dst, src);
|
|
189
|
-
}, rhs);
|
|
190
|
-
}, *this);
|
|
191
|
-
} else {
|
|
192
|
-
Destroy();
|
|
193
|
-
try {
|
|
194
|
-
ForwardVariant(std::move(rhs));
|
|
195
|
-
} catch (...) {
|
|
196
|
-
Index_ = ::TVariantSize<TVariant>::value;
|
|
197
|
-
throw;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
return *this;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
template <class T>
|
|
204
|
-
std::enable_if_t<!std::is_same<std::decay_t<T>, TVariant>::value,
|
|
205
|
-
TVariant&>
|
|
206
|
-
operator=(T&& value) {
|
|
207
|
-
if (::HoldsAlternative<std::decay_t<T>>(*this)) {
|
|
208
|
-
*ReinterpretAs<T>() = std::forward<T>(value);
|
|
209
|
-
} else {
|
|
210
|
-
emplace<T>(std::forward<T>(value));
|
|
211
|
-
}
|
|
212
|
-
return *this;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
void swap(TVariant& rhs) {
|
|
216
|
-
if (!valueless_by_exception() || !rhs.valueless_by_exception()) {
|
|
217
|
-
if (index() == rhs.index()) {
|
|
218
|
-
::Visit([&](auto& aVal) -> void {
|
|
219
|
-
::Visit([&](auto& bVal) -> void {
|
|
220
|
-
::NVariant::CallIfSame<void>([](auto& x, auto& y) {
|
|
221
|
-
DoSwap(x, y);
|
|
222
|
-
}, aVal, bVal);
|
|
223
|
-
}, rhs);
|
|
224
|
-
}, *this);
|
|
225
|
-
} else {
|
|
226
|
-
TVariant tmp(rhs);
|
|
227
|
-
rhs.Destroy();
|
|
228
|
-
rhs.ForwardVariant(std::move(*this));
|
|
229
|
-
Destroy();
|
|
230
|
-
ForwardVariant(std::move(tmp));
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
void Swap(TVariant& rhs) {
|
|
236
|
-
swap(rhs);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
template <class T, class... TArgs>
|
|
240
|
-
T& emplace(TArgs&&... args) {
|
|
241
|
-
Destroy();
|
|
242
|
-
try {
|
|
243
|
-
return EmplaceImpl<T>(std::forward<TArgs>(args)...);
|
|
244
|
-
} catch (...) {
|
|
245
|
-
Index_ = ::TVariantSize<TVariant>::value;
|
|
246
|
-
throw;
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
template <size_t I, class... TArgs, class T = TVariantAlternativeType<I, TVariant>>
|
|
251
|
-
T& emplace(TArgs&&... args) {
|
|
252
|
-
return emplace<T>(std::forward<TArgs>(args)...);
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
template <class T>
|
|
256
|
-
std::enable_if_t<!std::is_same<std::decay_t<T>, TVariant>::value,
|
|
257
|
-
bool>
|
|
258
|
-
operator==(const T& value) const {
|
|
259
|
-
return ::HoldsAlternative<T>(*this) && *ReinterpretAs<T>() == value;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
//! Standart integration
|
|
263
|
-
constexpr size_t index() const noexcept {
|
|
264
|
-
return valueless_by_exception() ? TVARIANT_NPOS : Index_;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/* A TVariant that is valueless by exception is treated as being in an invalid state:
|
|
268
|
-
* Index returns TVARIANT_NPOS, Get and Visit throw TWrongVariantError.
|
|
269
|
-
*/
|
|
270
|
-
constexpr bool valueless_by_exception() const noexcept {
|
|
271
|
-
return Index_ == ::TVariantSize<TVariant>::value;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
private:
|
|
275
|
-
void Destroy() noexcept {
|
|
276
|
-
if (!valueless_by_exception()) {
|
|
277
|
-
DestroyImpl();
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
void DestroyImpl() noexcept {
|
|
282
|
-
::Visit([](auto& value) {
|
|
283
|
-
using T = std::decay_t<decltype(value)>;
|
|
284
|
-
value.~T();
|
|
285
|
-
}, *this);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
template <class T, class... TArgs>
|
|
289
|
-
T& EmplaceImpl(TArgs&&... args) {
|
|
290
|
-
static_assert(TIndex<T>::value != TVARIANT_NPOS, "Type not in TVariant.");
|
|
291
|
-
new (&Storage_) std::decay_t<T>(std::forward<TArgs>(args)...);
|
|
292
|
-
Index_ = TIndex<T>::value;
|
|
293
|
-
return *ReinterpretAs<T>();
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
template <class Variant>
|
|
297
|
-
void ForwardVariant(Variant&& rhs) {
|
|
298
|
-
::Visit([&](auto&& value) {
|
|
299
|
-
new (this) TVariant(std::forward<decltype(value)>(value));
|
|
300
|
-
}, std::forward<Variant>(rhs));
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
private:
|
|
304
|
-
template <class T>
|
|
305
|
-
auto* ReinterpretAs() noexcept {
|
|
306
|
-
return reinterpret_cast<std::decay_t<T>*>(&Storage_);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
template <class T>
|
|
310
|
-
const auto* ReinterpretAs() const noexcept {
|
|
311
|
-
return reinterpret_cast<const std::decay_t<T>*>(&Storage_);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
friend struct NVariant::TVariantAccessor;
|
|
315
|
-
|
|
316
|
-
private:
|
|
317
|
-
size_t Index_ = ::TVariantSize<TVariant>::value;
|
|
318
|
-
std::aligned_union_t<0, Ts...> Storage_;
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
template <class... Ts>
|
|
322
|
-
bool operator==(const TVariant<Ts...>& a, const TVariant<Ts...>& b) {
|
|
323
|
-
if (a.index() != b.index()) {
|
|
324
|
-
return false;
|
|
325
|
-
}
|
|
326
|
-
return a.valueless_by_exception() || ::Visit([&](const auto& aVal) -> bool {
|
|
327
|
-
return ::Visit([&](const auto& bVal) -> bool {
|
|
328
|
-
return ::NVariant::CallIfSame<bool>([](const auto& x, const auto& y) {
|
|
329
|
-
return x == y;
|
|
330
|
-
}, aVal, bVal);
|
|
331
|
-
}, b);
|
|
332
|
-
}, a);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
template <class... Ts>
|
|
336
|
-
bool operator!=(const TVariant<Ts...>& a, const TVariant<Ts...>& b) {
|
|
337
|
-
// The standard forces as to call operator!= for values stored in variants.
|
|
338
|
-
// So we cannot reuse operator==.
|
|
339
|
-
if (a.index() != b.index()) {
|
|
340
|
-
return true;
|
|
341
|
-
}
|
|
342
|
-
return !a.valueless_by_exception() && ::Visit([&](const auto& aVal) -> bool {
|
|
343
|
-
return ::Visit([&](const auto& bVal) -> bool {
|
|
344
|
-
return ::NVariant::CallIfSame<bool>([](const auto& x, const auto& y) {
|
|
345
|
-
return x != y;
|
|
346
|
-
}, aVal, bVal);
|
|
347
|
-
}, b);
|
|
348
|
-
}, a);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
template <class... Ts>
|
|
352
|
-
bool operator<(const TVariant<Ts...>& a, const TVariant<Ts...>& b) {
|
|
353
|
-
if (b.valueless_by_exception()) {
|
|
354
|
-
return false;
|
|
355
|
-
}
|
|
356
|
-
if (a.valueless_by_exception()) {
|
|
357
|
-
return true;
|
|
358
|
-
}
|
|
359
|
-
if (a.index() == b.index()) {
|
|
360
|
-
return ::Visit([&](const auto& aVal) -> bool {
|
|
361
|
-
return ::Visit([&](const auto& bVal) -> bool {
|
|
362
|
-
return ::NVariant::CallIfSame<bool>([](const auto& x, const auto& y) {
|
|
363
|
-
return x < y;
|
|
364
|
-
}, aVal, bVal);
|
|
365
|
-
}, b);
|
|
366
|
-
}, a);
|
|
367
|
-
}
|
|
368
|
-
return a.index() < b.index();
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
template <class... Ts>
|
|
372
|
-
bool operator>(const TVariant<Ts...>& a, const TVariant<Ts...>& b) {
|
|
373
|
-
// The standard forces as to call operator> for values stored in variants.
|
|
374
|
-
// So we cannot reuse operator< and operator==.
|
|
375
|
-
if (a.valueless_by_exception()) {
|
|
376
|
-
return false;
|
|
377
|
-
}
|
|
378
|
-
if (b.valueless_by_exception()) {
|
|
379
|
-
return true;
|
|
380
|
-
}
|
|
381
|
-
if (a.index() == b.index()) {
|
|
382
|
-
return ::Visit([&](const auto& aVal) -> bool {
|
|
383
|
-
return ::Visit([&](const auto& bVal) -> bool {
|
|
384
|
-
return ::NVariant::CallIfSame<bool>([](const auto& x, const auto& y) {
|
|
385
|
-
return x > y;
|
|
386
|
-
}, aVal, bVal);
|
|
387
|
-
}, b);
|
|
388
|
-
}, a);
|
|
389
|
-
}
|
|
390
|
-
return a.index() > b.index();
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
template <class... Ts>
|
|
394
|
-
bool operator<=(const TVariant<Ts...>& a, const TVariant<Ts...>& b) {
|
|
395
|
-
// The standard forces as to call operator> for values stored in variants.
|
|
396
|
-
// So we cannot reuse operator< and operator==.
|
|
397
|
-
if (a.valueless_by_exception()) {
|
|
398
|
-
return true;
|
|
399
|
-
}
|
|
400
|
-
if (b.valueless_by_exception()) {
|
|
401
|
-
return false;
|
|
402
|
-
}
|
|
403
|
-
if (a.index() == b.index()) {
|
|
404
|
-
return ::Visit([&](const auto& aVal) -> bool {
|
|
405
|
-
return ::Visit([&](const auto& bVal) -> bool {
|
|
406
|
-
return ::NVariant::CallIfSame<bool>([](const auto& x, const auto& y) {
|
|
407
|
-
return x <= y;
|
|
408
|
-
}, aVal, bVal);
|
|
409
|
-
}, b);
|
|
410
|
-
}, a);
|
|
411
|
-
}
|
|
412
|
-
return a.index() < b.index();
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
template <class... Ts>
|
|
416
|
-
bool operator>=(const TVariant<Ts...>& a, const TVariant<Ts...>& b) {
|
|
417
|
-
// The standard forces as to call operator> for values stored in variants.
|
|
418
|
-
// So we cannot reuse operator< and operator==.
|
|
419
|
-
if (b.valueless_by_exception()) {
|
|
420
|
-
return true;
|
|
421
|
-
}
|
|
422
|
-
if (a.valueless_by_exception()) {
|
|
423
|
-
return false;
|
|
424
|
-
}
|
|
425
|
-
if (a.index() == b.index()) {
|
|
426
|
-
return ::Visit([&](const auto& aVal) -> bool {
|
|
427
|
-
return ::Visit([&](const auto& bVal) -> bool {
|
|
428
|
-
return ::NVariant::CallIfSame<bool>([](const auto& x, const auto& y) {
|
|
429
|
-
return x >= y;
|
|
430
|
-
}, aVal, bVal);
|
|
431
|
-
}, b);
|
|
432
|
-
}, a);
|
|
433
|
-
}
|
|
434
|
-
return a.index() > b.index();
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
namespace NVariant {
|
|
439
|
-
template <class F, class V>
|
|
440
|
-
decltype(auto) VisitImpl(F&& f, V&& v) {
|
|
441
|
-
using FRef = decltype(std::forward<F>(f));
|
|
442
|
-
using VRef = decltype(std::forward<V>(v));
|
|
443
|
-
static_assert(::NVariant::CheckReturnTypes<FRef, VRef>(
|
|
444
|
-
std::make_index_sequence<::TVariantSize<std::decay_t<V>>::value>{}),
|
|
445
|
-
"");
|
|
446
|
-
using ReturnType = ::NVariant::TReturnType<FRef, VRef>;
|
|
447
|
-
return ::NVariant::VisitWrapForVoid(
|
|
448
|
-
std::forward<F>(f), std::forward<V>(v), std::is_void<ReturnType>{});
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
template <class F, class... Ts>
|
|
453
|
-
decltype(auto) Visit(F&& f, TVariant<Ts...>& v) {
|
|
454
|
-
return ::NVariant::VisitImpl(std::forward<F>(f), v);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
template <class F, class... Ts>
|
|
458
|
-
decltype(auto) Visit(F&& f, const TVariant<Ts...>& v) {
|
|
459
|
-
return ::NVariant::VisitImpl(std::forward<F>(f), v);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
template <class F, class... Ts>
|
|
463
|
-
decltype(auto) Visit(F&& f, TVariant<Ts...>&& v) {
|
|
464
|
-
return ::NVariant::VisitImpl(std::forward<F>(f), std::move(v));
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
template <class F, class... Ts>
|
|
468
|
-
decltype(auto) Visit(F&& f, const TVariant<Ts...>&& v) {
|
|
469
|
-
return ::NVariant::VisitImpl(std::forward<F>(f), std::move(v));
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
template <class T, class... Ts>
|
|
474
|
-
constexpr bool HoldsAlternative(const TVariant<Ts...>& v) noexcept {
|
|
475
|
-
static_assert(::NVariant::TIndexOf<T, Ts...>::value != TVARIANT_NPOS, "T not in types");
|
|
476
|
-
return ::NVariant::TIndexOf<T, Ts...>::value == v.index();
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
namespace NVariant {
|
|
481
|
-
template <size_t I, class V>
|
|
482
|
-
decltype(auto) GetImpl(V&& v) {
|
|
483
|
-
Y_ENSURE_EX(v.index() == I, TWrongVariantError());
|
|
484
|
-
return ::NVariant::TVariantAccessor::Get<I>(std::forward<V>(v));
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
template <size_t I, class... Ts>
|
|
489
|
-
decltype(auto) Get(TVariant<Ts...>& v) {
|
|
490
|
-
return ::NVariant::GetImpl<I>(v);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
template <size_t I, class... Ts>
|
|
494
|
-
decltype(auto) Get(const TVariant<Ts...>& v) {
|
|
495
|
-
return ::NVariant::GetImpl<I>(v);
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
template <size_t I, class... Ts>
|
|
499
|
-
decltype(auto) Get(TVariant<Ts...>&& v) {
|
|
500
|
-
return ::NVariant::GetImpl<I>(std::move(v));
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
template <size_t I, class... Ts>
|
|
504
|
-
decltype(auto) Get(const TVariant<Ts...>&& v) {
|
|
505
|
-
return ::NVariant::GetImpl<I>(std::move(v));
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
namespace NVariant {
|
|
510
|
-
template <class T, class V>
|
|
511
|
-
decltype(auto) GetImpl(V&& v) {
|
|
512
|
-
return ::Get< ::NVariant::TAlternativeIndex<T, std::decay_t<V>>::value>(std::forward<V>(v));
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
template <class T, class... Ts>
|
|
517
|
-
decltype(auto) Get(TVariant<Ts...>& v) {
|
|
518
|
-
return ::NVariant::GetImpl<T>(v);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
template <class T, class... Ts>
|
|
522
|
-
decltype(auto) Get(const TVariant<Ts...>& v) {
|
|
523
|
-
return ::NVariant::GetImpl<T>(v);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
template <class T, class... Ts>
|
|
527
|
-
decltype(auto) Get(TVariant<Ts...>&& v) {
|
|
528
|
-
return ::NVariant::GetImpl<T>(std::move(v));
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
template <class T, class... Ts>
|
|
532
|
-
decltype(auto) Get(const TVariant<Ts...>&& v) {
|
|
533
|
-
return ::NVariant::GetImpl<T>(std::move(v));
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
template <size_t I, class... Ts>
|
|
538
|
-
auto* GetIf(TVariant<Ts...>* v) noexcept {
|
|
539
|
-
return v != nullptr && I == v->index() ? &::NVariant::TVariantAccessor::Get<I>(*v) : nullptr;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
template <size_t I, class... Ts>
|
|
543
|
-
const auto* GetIf(const TVariant<Ts...>* v) noexcept {
|
|
544
|
-
return v != nullptr && I == v->index() ? &::NVariant::TVariantAccessor::Get<I>(*v) : nullptr;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
template <class T, class... Ts>
|
|
548
|
-
T* GetIf(TVariant<Ts...>* v) noexcept {
|
|
549
|
-
return ::GetIf< ::NVariant::TIndexOf<T, Ts...>::value>(v);
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
template <class T, class... Ts>
|
|
553
|
-
const T* GetIf(const TVariant<Ts...>* v) noexcept {
|
|
554
|
-
return ::GetIf< ::NVariant::TIndexOf<T, Ts...>::value>(v);
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
template <class... Ts>
|
|
558
|
-
struct THash<TVariant<Ts...>> {
|
|
559
|
-
public:
|
|
560
|
-
inline size_t operator()(const TVariant<Ts...>& v) const {
|
|
561
|
-
const size_t tagHash = IntHash(v.index());
|
|
562
|
-
const size_t valueHash = v.valueless_by_exception() ? 0 : Visit(
|
|
563
|
-
[](const auto& value) {
|
|
564
|
-
using T = std::decay_t<decltype(value)>;
|
|
565
|
-
return ::THash<T>{}(value);
|
|
566
|
-
}, v);
|
|
567
|
-
return CombineHashes(tagHash, valueHash);
|
|
568
|
-
}
|
|
569
|
-
};
|
|
570
|
-
|
|
571
|
-
/* Unit type intended for use as a well-behaved empty alternative in TVariant.
|
|
572
|
-
* In particular, a variant of non-default-constructible types may list TMonostate
|
|
573
|
-
* as its first alternative: this makes the variant itself default-constructible.
|
|
574
|
-
*/
|
|
575
|
-
struct TMonostate {};
|
|
576
|
-
|
|
577
|
-
constexpr bool operator<(TMonostate, TMonostate) noexcept {
|
|
578
|
-
return false;
|
|
579
|
-
}
|
|
580
|
-
constexpr bool operator>(TMonostate, TMonostate) noexcept {
|
|
581
|
-
return false;
|
|
582
|
-
}
|
|
583
|
-
constexpr bool operator<=(TMonostate, TMonostate) noexcept {
|
|
584
|
-
return true;
|
|
585
|
-
}
|
|
586
|
-
constexpr bool operator>=(TMonostate, TMonostate) noexcept {
|
|
587
|
-
return true;
|
|
588
|
-
}
|
|
589
|
-
constexpr bool operator==(TMonostate, TMonostate) noexcept {
|
|
590
|
-
return true;
|
|
591
|
-
}
|
|
592
|
-
constexpr bool operator!=(TMonostate, TMonostate) noexcept {
|
|
593
|
-
return false;
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
template <>
|
|
597
|
-
struct THash<TMonostate> {
|
|
598
|
-
public:
|
|
599
|
-
inline constexpr size_t operator()(TMonostate) const noexcept {
|
|
600
|
-
return 1;
|
|
601
|
-
}
|
|
602
|
-
};
|
|
603
|
-
|
|
604
|
-
namespace NVariant {
|
|
605
|
-
template <size_t I, class... Ts>
|
|
606
|
-
TVariantAlternativeType<I, TVariant<Ts...>>& TVariantAccessor::Get(TVariant<Ts...>& v) {
|
|
607
|
-
return *v.template ReinterpretAs<TVariantAlternativeType<I, TVariant<Ts...>>>();
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
template <size_t I, class... Ts>
|
|
611
|
-
const TVariantAlternativeType<I, TVariant<Ts...>>& TVariantAccessor::Get(
|
|
612
|
-
const TVariant<Ts...>& v) {
|
|
613
|
-
return *v.template ReinterpretAs<TVariantAlternativeType<I, TVariant<Ts...>>>();
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
template <size_t I, class... Ts>
|
|
617
|
-
TVariantAlternativeType<I, TVariant<Ts...>>&& TVariantAccessor::Get(TVariant<Ts...>&& v) {
|
|
618
|
-
return std::move(*v.template ReinterpretAs<TVariantAlternativeType<I, TVariant<Ts...>>>());
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
template <size_t I, class... Ts>
|
|
622
|
-
const TVariantAlternativeType<I, TVariant<Ts...>>&& TVariantAccessor::Get(
|
|
623
|
-
const TVariant<Ts...>&& v) {
|
|
624
|
-
return std::move(*v.template ReinterpretAs<TVariantAlternativeType<I, TVariant<Ts...>>>());
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
template <class... Ts>
|
|
628
|
-
constexpr size_t TVariantAccessor::Index(const TVariant<Ts...>& v) noexcept {
|
|
629
|
-
return v.Index_;
|
|
630
|
-
}
|
|
631
|
-
}
|