aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorhaposik <haposik@yandex-team.ru>2022-02-10 16:50:37 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:37 +0300
commit8ae61e4a3dbd76284bc0d997975a50d6df18d448 (patch)
tree0488e488507ca5cc50c22d69336f5c9e258104d6 /library/cpp
parente0c1c9c8c8093d4093991068a2120f71b79bc35b (diff)
downloadydb-8ae61e4a3dbd76284bc0d997975a50d6df18d448.tar.gz
Restoring authorship annotation for <haposik@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/actors/core/mailbox.h2
-rw-r--r--library/cpp/containers/stack_vector/stack_vec.h46
-rw-r--r--library/cpp/containers/stack_vector/stack_vec_ut.cpp62
3 files changed, 55 insertions, 55 deletions
diff --git a/library/cpp/actors/core/mailbox.h b/library/cpp/actors/core/mailbox.h
index 0bd9c4d314..b4fe57a6c3 100644
--- a/library/cpp/actors/core/mailbox.h
+++ b/library/cpp/actors/core/mailbox.h
@@ -178,7 +178,7 @@ namespace NActors {
mp->emplace(ActorsInfo.Array.ActorsArray->Actors[i].ActorId, ActorsInfo.Array.ActorsArray->Actors[i].Actor);
}
mp->emplace(localActorId, actor);
- ActorPack = TMailboxActorPack::Map;
+ ActorPack = TMailboxActorPack::Map;
ActorsInfo.Array.ActorsCount = 0;
delete ActorsInfo.Array.ActorsArray;
ActorsInfo.Map.ActorsMap = mp;
diff --git a/library/cpp/containers/stack_vector/stack_vec.h b/library/cpp/containers/stack_vector/stack_vec.h
index fcc5d9a2a5..48032584e4 100644
--- a/library/cpp/containers/stack_vector/stack_vec.h
+++ b/library/cpp/containers/stack_vector/stack_vec.h
@@ -45,18 +45,18 @@ namespace NPrivate {
};
public:
- TStackBasedAllocator() = default;
-
- template <
- typename... TArgs,
- typename = std::enable_if_t<
- std::is_constructible_v<Alloc, TArgs...>
- >
- >
- TStackBasedAllocator(TArgs&&... args)
- : Alloc(std::forward<TArgs>(args)...)
- {}
-
+ TStackBasedAllocator() = default;
+
+ template <
+ typename... TArgs,
+ typename = std::enable_if_t<
+ std::is_constructible_v<Alloc, TArgs...>
+ >
+ >
+ TStackBasedAllocator(TArgs&&... args)
+ : Alloc(std::forward<TArgs>(args)...)
+ {}
+
T* allocate(size_type n) {
if (!IsStorageUsed && CountOnStack >= n) {
IsStorageUsed = true;
@@ -95,7 +95,7 @@ template <typename T, size_t CountOnStack, bool UseFallbackAlloc, class Alloc>
class TStackVec: public TVector<T, ::NPrivate::TStackBasedAllocator<T, CountOnStack, UseFallbackAlloc, TReboundAllocator<Alloc, T>>> {
private:
using TBase = TVector<T, ::NPrivate::TStackBasedAllocator<T, CountOnStack, UseFallbackAlloc, TReboundAllocator<Alloc, T>>>;
- using TAllocator = typename TBase::allocator_type;
+ using TAllocator = typename TBase::allocator_type;
public:
using typename TBase::const_iterator;
@@ -106,14 +106,14 @@ public:
using typename TBase::value_type;
public:
- TStackVec(const TAllocator& alloc = TAllocator())
- : TBase(alloc)
+ TStackVec(const TAllocator& alloc = TAllocator())
+ : TBase(alloc)
{
TBase::reserve(CountOnStack);
}
- explicit TStackVec(size_type count, const TAllocator& alloc = TAllocator())
- : TBase(alloc)
+ explicit TStackVec(size_type count, const TAllocator& alloc = TAllocator())
+ : TBase(alloc)
{
if (count <= CountOnStack) {
TBase::reserve(CountOnStack);
@@ -121,8 +121,8 @@ public:
TBase::resize(count);
}
- TStackVec(size_type count, const T& val, const TAllocator& alloc = TAllocator())
- : TBase(alloc)
+ TStackVec(size_type count, const T& val, const TAllocator& alloc = TAllocator())
+ : TBase(alloc)
{
if (count <= CountOnStack) {
TBase::reserve(CountOnStack);
@@ -141,14 +141,14 @@ public:
{
}
- TStackVec(std::initializer_list<T> il, const TAllocator& alloc = TAllocator())
- : TStackVec(il.begin(), il.end(), alloc)
+ TStackVec(std::initializer_list<T> il, const TAllocator& alloc = TAllocator())
+ : TStackVec(il.begin(), il.end(), alloc)
{
}
template <class TIter>
- TStackVec(TIter first, TIter last, const TAllocator& alloc = TAllocator())
- : TBase(alloc)
+ TStackVec(TIter first, TIter last, const TAllocator& alloc = TAllocator())
+ : TBase(alloc)
{
// NB(eeight) Since we want to call 'reserve' here, we cannot just delegate to TVector ctor.
// The best way to insert values afterwards is to call TVector::insert. However there is a caveat.
diff --git a/library/cpp/containers/stack_vector/stack_vec_ut.cpp b/library/cpp/containers/stack_vector/stack_vec_ut.cpp
index 19f9677781..85c25f21c0 100644
--- a/library/cpp/containers/stack_vector/stack_vec_ut.cpp
+++ b/library/cpp/containers/stack_vector/stack_vec_ut.cpp
@@ -19,28 +19,28 @@ namespace {
char Junk[JunkPayloadSize]{sizeof(T)};
};
-
- template <class T>
- struct TStatefulAlloc: public std::allocator<T> {
- using TBase = std::allocator<T>;
-
- template <class U>
- struct rebind {
- using other = TStatefulAlloc<U>;
- };
-
- TStatefulAlloc(size_t* allocCount)
- : AllocCount(allocCount)
- {}
-
- size_t* AllocCount;
-
- T* allocate(size_t n)
- {
- *AllocCount += 1;
- return TBase::allocate(n);
- }
- };
+
+ template <class T>
+ struct TStatefulAlloc: public std::allocator<T> {
+ using TBase = std::allocator<T>;
+
+ template <class U>
+ struct rebind {
+ using other = TStatefulAlloc<U>;
+ };
+
+ TStatefulAlloc(size_t* allocCount)
+ : AllocCount(allocCount)
+ {}
+
+ size_t* AllocCount;
+
+ T* allocate(size_t n)
+ {
+ *AllocCount += 1;
+ return TBase::allocate(n);
+ }
+ };
}
Y_UNIT_TEST_SUITE(TStackBasedVectorTest) {
@@ -132,13 +132,13 @@ Y_UNIT_TEST_SUITE(TStackBasedVectorTest) {
using TVec = TStackVec<size_t, 1, true, TThickAlloc<size_t, n>>;
UNIT_ASSERT_LT(sizeof(TVec), 1.5 * n);
}
-
- Y_UNIT_TEST(TestStatefulAlloc) {
- size_t count = 0;
- TStackVec<size_t, 1, true, TStatefulAlloc<size_t>> vec{{ &count }};
- for (size_t i = 0; i < 5; ++i) {
- vec.push_back(1);
- }
- UNIT_ASSERT_VALUES_EQUAL(count, 3);
- }
+
+ Y_UNIT_TEST(TestStatefulAlloc) {
+ size_t count = 0;
+ TStackVec<size_t, 1, true, TStatefulAlloc<size_t>> vec{{ &count }};
+ for (size_t i = 0; i < 5; ++i) {
+ vec.push_back(1);
+ }
+ UNIT_ASSERT_VALUES_EQUAL(count, 3);
+ }
}