diff options
author | eeight <eeight@yandex-team.ru> | 2022-02-10 16:46:19 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:19 +0300 |
commit | bd085aee9b4f7a0bee302ce687964ffb7098f986 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/containers/sorted_vector | |
parent | 475c0a46f28166e83fd263badc7546377cddcabe (diff) | |
download | ydb-bd085aee9b4f7a0bee302ce687964ffb7098f986.tar.gz |
Restoring authorship annotation for <eeight@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/containers/sorted_vector')
-rw-r--r-- | library/cpp/containers/sorted_vector/sorted_vector.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/library/cpp/containers/sorted_vector/sorted_vector.h b/library/cpp/containers/sorted_vector/sorted_vector.h index 93c4bdfb44..123539af9e 100644 --- a/library/cpp/containers/sorted_vector/sorted_vector.h +++ b/library/cpp/containers/sorted_vector/sorted_vector.h @@ -4,7 +4,7 @@ #include <util/generic/hash.h> #include <util/generic/vector.h> #include <util/generic/algorithm.h> -#include <util/generic/mapfindptr.h> +#include <util/generic/mapfindptr.h> #include <util/ysaveload.h> #include <utility> @@ -328,10 +328,10 @@ namespace NSorted { // and then inserts a new one, the existing reference can be broken (due to reallocation). // Please keep this in mind when using this structure. template <typename TKeyType, typename TValueType, class TPredicate = TLess<TKeyType>, class A = std::allocator<TValueType>> - class TSimpleMap: - public TSortedVector<std::pair<TKeyType, TValueType>, TKeyType, TSelect1st, TPredicate, A>, - public TMapOps<TSimpleMap<TKeyType, TValueType, TPredicate, A>> - { + class TSimpleMap: + public TSortedVector<std::pair<TKeyType, TValueType>, TKeyType, TSelect1st, TPredicate, A>, + public TMapOps<TSimpleMap<TKeyType, TValueType, TPredicate, A>> + { private: typedef TSortedVector<std::pair<TKeyType, TValueType>, TKeyType, TSelect1st, TPredicate, A> TBase; @@ -379,22 +379,22 @@ namespace NSorted { Y_FORCE_INLINE TValueType& operator[](const K& key) { return Get(key); } - + template<class K> const TValueType& at(const K& key) const { - const auto i = TBase::Find(key); - if (i == TBase::end()) { - throw std::out_of_range("NSorted::TSimpleMap: missing key"); - } - - return i->second; - } - + const auto i = TBase::Find(key); + if (i == TBase::end()) { + throw std::out_of_range("NSorted::TSimpleMap: missing key"); + } + + return i->second; + } + template<class K> TValueType& at(const K& key) { - return const_cast<TValueType&>( - const_cast<const TSimpleMap<TKeyType, TValueType, TPredicate, A>*>(this)->at(key)); - } + return const_cast<TValueType&>( + const_cast<const TSimpleMap<TKeyType, TValueType, TPredicate, A>*>(this)->at(key)); + } }; // The simplified set (a.k.a TFlatSet, flat_set), which is implemented by the sorted-vector. |