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,140 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <util/system/compiler.h>
|
|
4
|
-
#include <util/system/types.h>
|
|
5
|
-
|
|
6
|
-
#if defined(_MSC_VER) && defined(_M_X64)
|
|
7
|
-
#include <intrin.h>
|
|
8
|
-
#endif
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Calculates the number of buckets for the hash table that will hold the given
|
|
14
|
-
* number of elements.
|
|
15
|
-
*
|
|
16
|
-
* @param elementCount Number of elements that the hash table will hold.
|
|
17
|
-
* @returns Number of buckets, a prime number that is
|
|
18
|
-
* greater or equal to `elementCount`.
|
|
19
|
-
*/
|
|
20
|
-
Y_CONST_FUNCTION
|
|
21
|
-
unsigned long HashBucketCount(unsigned long elementCount);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
namespace NPrivate {
|
|
25
|
-
|
|
26
|
-
/// Implementation of algorithm 4.1 from: Torbjörn Granlund and Peter L. Montgomery. 1994. Division by invariant integers using multiplication.
|
|
27
|
-
/// @see https://gmplib.org/~tege/divcnst-pldi94.pdf
|
|
28
|
-
template <typename TDivisor, typename TDividend, typename MulUnsignedUpper>
|
|
29
|
-
class TReciprocalDivisor {
|
|
30
|
-
static_assert(sizeof(TDivisor) <= sizeof(TDividend), "TDivisor and TDividend should have the same size");
|
|
31
|
-
public:
|
|
32
|
-
constexpr TReciprocalDivisor() noexcept = default;
|
|
33
|
-
|
|
34
|
-
constexpr TReciprocalDivisor(TDividend reciprocal, ui8 reciprocalShift, i8 hint, TDivisor divisor) noexcept
|
|
35
|
-
: Reciprocal(reciprocal)
|
|
36
|
-
, Divisor(divisor)
|
|
37
|
-
, ReciprocalShift(reciprocalShift)
|
|
38
|
-
, Hint(hint)
|
|
39
|
-
{
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/// Return (dividend % Divisor)
|
|
43
|
-
Y_FORCE_INLINE TDividend Remainder(TDividend dividend) const noexcept {
|
|
44
|
-
if (Y_UNLIKELY(Divisor == 1)) {
|
|
45
|
-
return 0;
|
|
46
|
-
}
|
|
47
|
-
TDividend r = dividend - Quotent(dividend) * Divisor;
|
|
48
|
-
return r;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
Y_FORCE_INLINE TDivisor operator()() const noexcept {
|
|
52
|
-
return Divisor;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
Y_FORCE_INLINE static constexpr TReciprocalDivisor One() noexcept {
|
|
56
|
-
return {1u, 0u, -1, 1u};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
private:
|
|
60
|
-
/// returns (dividend / Divisor)
|
|
61
|
-
Y_FORCE_INLINE TDividend Quotent(TDividend dividend) const noexcept {
|
|
62
|
-
const TDividend t = MulUnsignedUpper{}(dividend, Reciprocal);
|
|
63
|
-
const TDividend q = (t + ((dividend - t) >> 1)) >> ReciprocalShift;
|
|
64
|
-
return q;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public:
|
|
68
|
-
TDividend Reciprocal = 0;
|
|
69
|
-
TDivisor Divisor = 0;
|
|
70
|
-
ui8 ReciprocalShift = 0;
|
|
71
|
-
i8 Hint = 0; ///< Additional data: needless for division, but useful for the adjacent divisors search
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
template <typename T, typename TExtended, size_t shift>
|
|
75
|
-
struct TMulUnsignedUpper {
|
|
76
|
-
/// Return the high bits of the product of two unsigned integers.
|
|
77
|
-
Y_FORCE_INLINE T operator()(T a, T b) const noexcept {
|
|
78
|
-
return (static_cast<TExtended>(a) * static_cast<TExtended>(b)) >> shift;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
#if defined(_32_)
|
|
83
|
-
using THashDivisor = ::NPrivate::TReciprocalDivisor<ui32, ui32, TMulUnsignedUpper<ui32, ui64, 32>>;
|
|
84
|
-
#else
|
|
85
|
-
#if defined(Y_HAVE_INT128)
|
|
86
|
-
using THashDivisor = ::NPrivate::TReciprocalDivisor<ui32, ui64, TMulUnsignedUpper<ui64, unsigned __int128, 64>>;
|
|
87
|
-
#elif defined(_MSC_VER) && defined(_M_X64)
|
|
88
|
-
struct TMulUnsignedUpperVCIntrin {
|
|
89
|
-
/// Return the high 64 bits of the product of two 64-bit unsigned integers.
|
|
90
|
-
Y_FORCE_INLINE ui64 operator()(ui64 a, ui64 b) const noexcept {
|
|
91
|
-
return __umulh(a, b);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
using THashDivisor = ::NPrivate::TReciprocalDivisor<ui32, ui64, TMulUnsignedUpperVCIntrin>;
|
|
95
|
-
#else
|
|
96
|
-
template <typename TDivisor, typename TDividend>
|
|
97
|
-
class TNaiveDivisor {
|
|
98
|
-
public:
|
|
99
|
-
constexpr TNaiveDivisor() noexcept = default;
|
|
100
|
-
|
|
101
|
-
constexpr TNaiveDivisor(TDivisor divisor) noexcept
|
|
102
|
-
: Divisor(divisor)
|
|
103
|
-
{
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
constexpr TNaiveDivisor(TDividend reciprocal, ui8 reciprocalShift, i8 hint, TDivisor divisor) noexcept
|
|
107
|
-
: TNaiveDivisor(divisor)
|
|
108
|
-
{
|
|
109
|
-
Y_UNUSED(reciprocal);
|
|
110
|
-
Y_UNUSED(reciprocalShift);
|
|
111
|
-
Y_UNUSED(hint);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
Y_FORCE_INLINE TDividend Remainder(TDividend dividend) const noexcept {
|
|
115
|
-
return dividend % Divisor;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
Y_FORCE_INLINE TDivisor operator()() const noexcept {
|
|
119
|
-
return Divisor;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
Y_FORCE_INLINE static constexpr TNaiveDivisor One() noexcept {
|
|
123
|
-
return {1u};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
public:
|
|
127
|
-
TDivisor Divisor = 0;
|
|
128
|
-
static constexpr i8 Hint = -1;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
using THashDivisor = ::NPrivate::TNaiveDivisor<ui32, ui64>;
|
|
132
|
-
#endif
|
|
133
|
-
#endif
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
Y_CONST_FUNCTION
|
|
137
|
-
::NPrivate::THashDivisor HashBucketCountExt(unsigned long elementCount);
|
|
138
|
-
|
|
139
|
-
Y_CONST_FUNCTION
|
|
140
|
-
::NPrivate::THashDivisor HashBucketCountExt(unsigned long elementCount, int hint);
|
|
@@ -1,490 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include "fwd.h"
|
|
4
|
-
#include "hash.h"
|
|
5
|
-
|
|
6
|
-
#include <initializer_list>
|
|
7
|
-
#include <utility>
|
|
8
|
-
|
|
9
|
-
#undef value_type
|
|
10
|
-
|
|
11
|
-
template <class Value, class HashFcn, class EqualKey, class Alloc>
|
|
12
|
-
class THashSet {
|
|
13
|
-
private:
|
|
14
|
-
using ht = THashTable<Value, Value, HashFcn, ::TIdentity, EqualKey, Alloc>;
|
|
15
|
-
ht rep;
|
|
16
|
-
|
|
17
|
-
using mutable_iterator = typename ht::iterator;
|
|
18
|
-
|
|
19
|
-
public:
|
|
20
|
-
using key_type = typename ht::key_type;
|
|
21
|
-
using value_type = typename ht::value_type;
|
|
22
|
-
using hasher = typename ht::hasher;
|
|
23
|
-
using key_equal = typename ht::key_equal;
|
|
24
|
-
using allocator_type = typename ht::allocator_type;
|
|
25
|
-
using node_allocator_type = typename ht::node_allocator_type;
|
|
26
|
-
|
|
27
|
-
using size_type = typename ht::size_type;
|
|
28
|
-
using difference_type = typename ht::difference_type;
|
|
29
|
-
using pointer = typename ht::const_pointer;
|
|
30
|
-
using const_pointer = typename ht::const_pointer;
|
|
31
|
-
using reference = typename ht::const_reference;
|
|
32
|
-
using const_reference = typename ht::const_reference;
|
|
33
|
-
|
|
34
|
-
using iterator = typename ht::const_iterator;
|
|
35
|
-
using const_iterator = typename ht::const_iterator;
|
|
36
|
-
using insert_ctx = typename ht::insert_ctx;
|
|
37
|
-
|
|
38
|
-
hasher hash_function() const {
|
|
39
|
-
return rep.hash_function();
|
|
40
|
-
}
|
|
41
|
-
key_equal key_eq() const {
|
|
42
|
-
return rep.key_eq();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public:
|
|
46
|
-
THashSet() {
|
|
47
|
-
}
|
|
48
|
-
template <class TT>
|
|
49
|
-
explicit THashSet(TT* allocParam, size_type n = 0)
|
|
50
|
-
: rep(n, hasher(), key_equal(), allocParam)
|
|
51
|
-
{
|
|
52
|
-
}
|
|
53
|
-
explicit THashSet(size_type n)
|
|
54
|
-
: rep(n, hasher(), key_equal())
|
|
55
|
-
{
|
|
56
|
-
}
|
|
57
|
-
THashSet(size_type n, const hasher& hf)
|
|
58
|
-
: rep(n, hf, key_equal())
|
|
59
|
-
{
|
|
60
|
-
}
|
|
61
|
-
THashSet(size_type n, const hasher& hf, const key_equal& eql)
|
|
62
|
-
: rep(n, hf, eql)
|
|
63
|
-
{
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
THashSet(std::initializer_list<value_type> list)
|
|
67
|
-
: rep(list.size(), hasher(), key_equal())
|
|
68
|
-
{
|
|
69
|
-
rep.insert_unique(list.begin(), list.end());
|
|
70
|
-
}
|
|
71
|
-
THashSet(std::initializer_list<value_type> list, size_type n)
|
|
72
|
-
: rep(n, hasher(), key_equal())
|
|
73
|
-
{
|
|
74
|
-
rep.insert_unique(list.begin(), list.end());
|
|
75
|
-
}
|
|
76
|
-
THashSet(std::initializer_list<value_type> list, size_type n, const hasher& hf)
|
|
77
|
-
: rep(n, hf, key_equal())
|
|
78
|
-
{
|
|
79
|
-
rep.insert_unique(list.begin(), list.end());
|
|
80
|
-
}
|
|
81
|
-
THashSet(std::initializer_list<value_type> list, size_type n, const hasher& hf, const key_equal& eql)
|
|
82
|
-
: rep(n, hf, eql)
|
|
83
|
-
{
|
|
84
|
-
rep.insert_unique(list.begin(), list.end());
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
template <class InputIterator>
|
|
88
|
-
THashSet(InputIterator f, InputIterator l)
|
|
89
|
-
: rep(0, hasher(), key_equal())
|
|
90
|
-
{
|
|
91
|
-
rep.insert_unique(f, l);
|
|
92
|
-
}
|
|
93
|
-
template <class InputIterator>
|
|
94
|
-
THashSet(InputIterator f, InputIterator l, size_type n)
|
|
95
|
-
: rep(n, hasher(), key_equal())
|
|
96
|
-
{
|
|
97
|
-
rep.insert_unique(f, l);
|
|
98
|
-
}
|
|
99
|
-
template <class InputIterator>
|
|
100
|
-
THashSet(InputIterator f, InputIterator l, size_type n,
|
|
101
|
-
const hasher& hf)
|
|
102
|
-
: rep(n, hf, key_equal())
|
|
103
|
-
{
|
|
104
|
-
rep.insert_unique(f, l);
|
|
105
|
-
}
|
|
106
|
-
template <class InputIterator>
|
|
107
|
-
THashSet(InputIterator f, InputIterator l, size_type n,
|
|
108
|
-
const hasher& hf, const key_equal& eql)
|
|
109
|
-
: rep(n, hf, eql)
|
|
110
|
-
{
|
|
111
|
-
rep.insert_unique(f, l);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// THashSet has implicit copy/move constructors and copy-/move-assignment operators
|
|
115
|
-
// because its implementation is backed by THashTable.
|
|
116
|
-
// See hash_ut.cpp
|
|
117
|
-
|
|
118
|
-
public:
|
|
119
|
-
size_type size() const {
|
|
120
|
-
return rep.size();
|
|
121
|
-
}
|
|
122
|
-
size_type max_size() const {
|
|
123
|
-
return rep.max_size();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
Y_PURE_FUNCTION
|
|
127
|
-
bool empty() const {
|
|
128
|
-
return rep.empty();
|
|
129
|
-
}
|
|
130
|
-
explicit operator bool() const noexcept {
|
|
131
|
-
return !empty();
|
|
132
|
-
}
|
|
133
|
-
void swap(THashSet& hs) {
|
|
134
|
-
rep.swap(hs.rep);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
iterator begin() const {
|
|
138
|
-
return rep.begin();
|
|
139
|
-
}
|
|
140
|
-
iterator end() const {
|
|
141
|
-
return rep.end();
|
|
142
|
-
}
|
|
143
|
-
iterator cbegin() const {
|
|
144
|
-
return rep.begin();
|
|
145
|
-
}
|
|
146
|
-
iterator cend() const {
|
|
147
|
-
return rep.end();
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
public:
|
|
151
|
-
void insert(std::initializer_list<value_type> ilist) {
|
|
152
|
-
insert(ilist.begin(), ilist.end());
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
template <class InputIterator>
|
|
156
|
-
void insert(InputIterator f, InputIterator l) {
|
|
157
|
-
rep.insert_unique(f, l);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
std::pair<iterator, bool> insert(const value_type& obj) {
|
|
161
|
-
std::pair<mutable_iterator, bool> p = rep.insert_unique(obj);
|
|
162
|
-
return std::pair<iterator, bool>(p.first, p.second);
|
|
163
|
-
}
|
|
164
|
-
template <typename... Args>
|
|
165
|
-
std::pair<iterator, bool> emplace(Args&&... args) {
|
|
166
|
-
std::pair<mutable_iterator, bool> p = rep.emplace_unique(std::forward<Args>(args)...);
|
|
167
|
-
return std::pair<iterator, bool>(p.first, p.second);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
iterator insert(const_iterator, const value_type& obj) { // insert_hint
|
|
171
|
-
std::pair<mutable_iterator, bool> p = rep.insert_unique(obj);
|
|
172
|
-
return p.first;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
std::pair<iterator, bool> insert_noresize(const value_type& obj) {
|
|
176
|
-
std::pair<mutable_iterator, bool> p = rep.insert_unique_noresize(obj);
|
|
177
|
-
return std::pair<iterator, bool>(p.first, p.second);
|
|
178
|
-
}
|
|
179
|
-
template <typename... Args>
|
|
180
|
-
std::pair<iterator, bool> emplace_noresize(Args&&... args) {
|
|
181
|
-
std::pair<mutable_iterator, bool> p = rep.emplace_unique_noresize(std::forward<Args>(args)...);
|
|
182
|
-
return std::pair<iterator, bool>(p.first, p.second);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
template <class TheObj>
|
|
186
|
-
iterator insert_direct(const TheObj& obj, const insert_ctx& ins) {
|
|
187
|
-
return rep.insert_direct(obj, ins);
|
|
188
|
-
}
|
|
189
|
-
template <typename... Args>
|
|
190
|
-
iterator emplace_direct(const insert_ctx& ins, Args&&... args) {
|
|
191
|
-
return rep.emplace_direct(ins, std::forward<Args>(args)...);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
template <class TheKey>
|
|
195
|
-
const_iterator find(const TheKey& key) const {
|
|
196
|
-
return rep.find(key);
|
|
197
|
-
}
|
|
198
|
-
template <class TheKey>
|
|
199
|
-
iterator find(const TheKey& key, insert_ctx& ins) {
|
|
200
|
-
return rep.find_i(key, ins);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
template <class TheKey>
|
|
204
|
-
bool contains(const TheKey& key) const {
|
|
205
|
-
return rep.find(key) != rep.end();
|
|
206
|
-
}
|
|
207
|
-
template <class TheKey>
|
|
208
|
-
bool contains(const TheKey& key, insert_ctx& ins) {
|
|
209
|
-
return rep.find_i(key, ins) != rep.end();
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
template <class TKey>
|
|
213
|
-
size_type count(const TKey& key) const {
|
|
214
|
-
return rep.count(key);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
template <class TKey>
|
|
218
|
-
std::pair<iterator, iterator> equal_range(const TKey& key) const {
|
|
219
|
-
return rep.equal_range(key);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
size_type erase(const key_type& key) {
|
|
223
|
-
return rep.erase(key);
|
|
224
|
-
}
|
|
225
|
-
void erase(iterator it) {
|
|
226
|
-
rep.erase(it);
|
|
227
|
-
}
|
|
228
|
-
void erase(iterator f, iterator l) {
|
|
229
|
-
rep.erase(f, l);
|
|
230
|
-
}
|
|
231
|
-
void clear() {
|
|
232
|
-
rep.clear();
|
|
233
|
-
}
|
|
234
|
-
void clear(size_t downsize_hint) {
|
|
235
|
-
rep.clear(downsize_hint);
|
|
236
|
-
}
|
|
237
|
-
void basic_clear() {
|
|
238
|
-
rep.basic_clear();
|
|
239
|
-
}
|
|
240
|
-
void release_nodes() {
|
|
241
|
-
rep.release_nodes();
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
template <class KeySaver>
|
|
245
|
-
int save_for_st(IOutputStream* stream, KeySaver& ks) const {
|
|
246
|
-
return rep.template save_for_st<KeySaver>(stream, ks);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
public:
|
|
250
|
-
void reserve(size_type hint) {
|
|
251
|
-
rep.reserve(hint);
|
|
252
|
-
}
|
|
253
|
-
size_type bucket_count() const {
|
|
254
|
-
return rep.bucket_count();
|
|
255
|
-
}
|
|
256
|
-
size_type bucket_size(size_type n) const {
|
|
257
|
-
return rep.bucket_size(n);
|
|
258
|
-
}
|
|
259
|
-
node_allocator_type& GetNodeAllocator() {
|
|
260
|
-
return rep.GetNodeAllocator();
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
template <class Value, class HashFcn, class EqualKey, class Alloc>
|
|
265
|
-
inline bool operator==(const THashSet<Value, HashFcn, EqualKey, Alloc>& hs1, const THashSet<Value, HashFcn, EqualKey, Alloc>& hs2) {
|
|
266
|
-
if (hs1.size() != hs2.size()) {
|
|
267
|
-
return false;
|
|
268
|
-
}
|
|
269
|
-
for (const auto& it : hs1) {
|
|
270
|
-
if (!hs2.contains(it)) {
|
|
271
|
-
return false;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
return true;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
template <class Value, class HashFcn, class EqualKey, class Alloc>
|
|
278
|
-
inline bool operator!=(const THashSet<Value, HashFcn, EqualKey, Alloc>& hs1, const THashSet<Value, HashFcn, EqualKey, Alloc>& hs2) {
|
|
279
|
-
return !(hs1 == hs2);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
template <class Value, class HashFcn, class EqualKey, class Alloc>
|
|
283
|
-
class THashMultiSet {
|
|
284
|
-
private:
|
|
285
|
-
using ht = THashTable<Value, Value, HashFcn, ::TIdentity, EqualKey, Alloc>;
|
|
286
|
-
ht rep;
|
|
287
|
-
|
|
288
|
-
public:
|
|
289
|
-
using key_type = typename ht::key_type;
|
|
290
|
-
using value_type = typename ht::value_type;
|
|
291
|
-
using hasher = typename ht::hasher;
|
|
292
|
-
using key_equal = typename ht::key_equal;
|
|
293
|
-
using allocator_type = typename ht::allocator_type;
|
|
294
|
-
using node_allocator_type = typename ht::node_allocator_type;
|
|
295
|
-
|
|
296
|
-
using size_type = typename ht::size_type;
|
|
297
|
-
using difference_type = typename ht::difference_type;
|
|
298
|
-
using pointer = typename ht::const_pointer;
|
|
299
|
-
using const_pointer = typename ht::const_pointer;
|
|
300
|
-
using reference = typename ht::const_reference;
|
|
301
|
-
using const_reference = typename ht::const_reference;
|
|
302
|
-
|
|
303
|
-
using iterator = typename ht::const_iterator;
|
|
304
|
-
using const_iterator = typename ht::const_iterator;
|
|
305
|
-
|
|
306
|
-
hasher hash_function() const {
|
|
307
|
-
return rep.hash_function();
|
|
308
|
-
}
|
|
309
|
-
key_equal key_eq() const {
|
|
310
|
-
return rep.key_eq();
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
public:
|
|
314
|
-
THashMultiSet()
|
|
315
|
-
: rep(0, hasher(), key_equal())
|
|
316
|
-
{
|
|
317
|
-
}
|
|
318
|
-
explicit THashMultiSet(size_type n)
|
|
319
|
-
: rep(n, hasher(), key_equal())
|
|
320
|
-
{
|
|
321
|
-
}
|
|
322
|
-
THashMultiSet(size_type n, const hasher& hf)
|
|
323
|
-
: rep(n, hf, key_equal())
|
|
324
|
-
{
|
|
325
|
-
}
|
|
326
|
-
THashMultiSet(size_type n, const hasher& hf, const key_equal& eql)
|
|
327
|
-
: rep(n, hf, eql)
|
|
328
|
-
{
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
template <class InputIterator>
|
|
332
|
-
THashMultiSet(InputIterator f, InputIterator l)
|
|
333
|
-
: rep(0, hasher(), key_equal())
|
|
334
|
-
{
|
|
335
|
-
rep.insert_equal(f, l);
|
|
336
|
-
}
|
|
337
|
-
template <class InputIterator>
|
|
338
|
-
THashMultiSet(InputIterator f, InputIterator l, size_type n)
|
|
339
|
-
: rep(n, hasher(), key_equal())
|
|
340
|
-
{
|
|
341
|
-
rep.insert_equal(f, l);
|
|
342
|
-
}
|
|
343
|
-
template <class InputIterator>
|
|
344
|
-
THashMultiSet(InputIterator f, InputIterator l, size_type n,
|
|
345
|
-
const hasher& hf)
|
|
346
|
-
: rep(n, hf, key_equal())
|
|
347
|
-
{
|
|
348
|
-
rep.insert_equal(f, l);
|
|
349
|
-
}
|
|
350
|
-
template <class InputIterator>
|
|
351
|
-
THashMultiSet(InputIterator f, InputIterator l, size_type n,
|
|
352
|
-
const hasher& hf, const key_equal& eql)
|
|
353
|
-
: rep(n, hf, eql)
|
|
354
|
-
{
|
|
355
|
-
rep.insert_equal(f, l);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
THashMultiSet(std::initializer_list<value_type> list)
|
|
359
|
-
: rep(list.size(), hasher(), key_equal())
|
|
360
|
-
{
|
|
361
|
-
rep.insert_equal(list.begin(), list.end());
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// THashMultiSet has implicit copy/move constructors and copy-/move-assignment operators
|
|
365
|
-
// because its implementation is backed by THashTable.
|
|
366
|
-
// See hash_ut.cpp
|
|
367
|
-
|
|
368
|
-
public:
|
|
369
|
-
size_type size() const {
|
|
370
|
-
return rep.size();
|
|
371
|
-
}
|
|
372
|
-
size_type max_size() const {
|
|
373
|
-
return rep.max_size();
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
Y_PURE_FUNCTION
|
|
377
|
-
bool empty() const {
|
|
378
|
-
return rep.empty();
|
|
379
|
-
}
|
|
380
|
-
explicit operator bool() const noexcept {
|
|
381
|
-
return !empty();
|
|
382
|
-
}
|
|
383
|
-
void swap(THashMultiSet& hs) {
|
|
384
|
-
rep.swap(hs.rep);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
iterator begin() const {
|
|
388
|
-
return rep.begin();
|
|
389
|
-
}
|
|
390
|
-
iterator end() const {
|
|
391
|
-
return rep.end();
|
|
392
|
-
}
|
|
393
|
-
iterator cbegin() const {
|
|
394
|
-
return rep.begin();
|
|
395
|
-
}
|
|
396
|
-
iterator cend() const {
|
|
397
|
-
return rep.end();
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
public:
|
|
401
|
-
iterator insert(const value_type& obj) {
|
|
402
|
-
return rep.insert_equal(obj);
|
|
403
|
-
}
|
|
404
|
-
template <typename... Args>
|
|
405
|
-
iterator emplace(Args&&... args) {
|
|
406
|
-
return rep.emplace_equal(std::forward<Args>(args)...);
|
|
407
|
-
}
|
|
408
|
-
template <class InputIterator>
|
|
409
|
-
void insert(InputIterator f, InputIterator l) {
|
|
410
|
-
rep.insert_equal(f, l);
|
|
411
|
-
}
|
|
412
|
-
iterator insert_noresize(const value_type& obj) {
|
|
413
|
-
return rep.insert_equal_noresize(obj);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
template <class TKey>
|
|
417
|
-
iterator find(const TKey& key) const {
|
|
418
|
-
return rep.find(key);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
template <class TKey>
|
|
422
|
-
size_type count(const TKey& key) const {
|
|
423
|
-
return rep.count(key);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
template <class TKey>
|
|
427
|
-
std::pair<iterator, iterator> equal_range(const TKey& key) const {
|
|
428
|
-
return rep.equal_range(key);
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
size_type erase(const key_type& key) {
|
|
432
|
-
return rep.erase(key);
|
|
433
|
-
}
|
|
434
|
-
void erase(iterator it) {
|
|
435
|
-
rep.erase(it);
|
|
436
|
-
}
|
|
437
|
-
void erase(iterator f, iterator l) {
|
|
438
|
-
rep.erase(f, l);
|
|
439
|
-
}
|
|
440
|
-
void clear() {
|
|
441
|
-
rep.clear();
|
|
442
|
-
}
|
|
443
|
-
void clear(size_t downsize_hint) {
|
|
444
|
-
rep.clear(downsize_hint);
|
|
445
|
-
}
|
|
446
|
-
void basic_clear() {
|
|
447
|
-
rep.basic_clear();
|
|
448
|
-
}
|
|
449
|
-
void release_nodes() {
|
|
450
|
-
rep.release_nodes();
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
public:
|
|
454
|
-
void reserve(size_type hint) {
|
|
455
|
-
rep.reserve(hint);
|
|
456
|
-
}
|
|
457
|
-
size_type bucket_count() const {
|
|
458
|
-
return rep.bucket_count();
|
|
459
|
-
}
|
|
460
|
-
size_type bucket_size(size_type n) const {
|
|
461
|
-
return rep.bucket_size(n);
|
|
462
|
-
}
|
|
463
|
-
node_allocator_type& GetNodeAllocator() {
|
|
464
|
-
return rep.GetNodeAllocator();
|
|
465
|
-
}
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
template <class Val, class HashFcn, class EqualKey, class Alloc>
|
|
469
|
-
inline bool operator==(const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs1, const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs2) {
|
|
470
|
-
if (hs1.size() != hs2.size()) {
|
|
471
|
-
return false;
|
|
472
|
-
}
|
|
473
|
-
EqualKey equalKey;
|
|
474
|
-
auto it = hs1.begin();
|
|
475
|
-
while (it != hs1.end()) {
|
|
476
|
-
const auto& value = *it;
|
|
477
|
-
size_t count = 0;
|
|
478
|
-
for (; (it != hs1.end()) && (equalKey(*it, value)); ++it, ++count) {
|
|
479
|
-
}
|
|
480
|
-
if (hs2.count(value) != count) {
|
|
481
|
-
return false;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
return true;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
template <class Val, class HashFcn, class EqualKey, class Alloc>
|
|
488
|
-
inline bool operator!=(const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs1, const THashMultiSet<Val, HashFcn, EqualKey, Alloc>& hs2) {
|
|
489
|
-
return !(hs1 == hs2);
|
|
490
|
-
}
|