diff options
author | eeight <eeight@yandex-team.ru> | 2022-02-10 16:46:18 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:18 +0300 |
commit | 475c0a46f28166e83fd263badc7546377cddcabe (patch) | |
tree | 39c5a49b8aaad78fe390b6f1f2886bdbda40f3e7 /library/cpp/containers/sorted_vector | |
parent | a6e0145a095c7bb3770d6e07aee301de5c73f96e (diff) | |
download | ydb-475c0a46f28166e83fd263badc7546377cddcabe.tar.gz |
Restoring authorship annotation for <eeight@yandex-team.ru>. Commit 1 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 123539af9e..93c4bdfb44 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. |