aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/iterator_range.h
diff options
context:
space:
mode:
authorpechatnov <pechatnov@yandex-team.ru>2022-02-10 16:48:57 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:57 +0300
commit132a3640fac343164b858d0a914e020a848a2848 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/generic/iterator_range.h
parent8e9b2f8bbf4a2320f539eef5b85555f42c065425 (diff)
downloadydb-132a3640fac343164b858d0a914e020a848a2848.tar.gz
Restoring authorship annotation for <pechatnov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/iterator_range.h')
-rw-r--r--util/generic/iterator_range.h106
1 files changed, 53 insertions, 53 deletions
diff --git a/util/generic/iterator_range.h b/util/generic/iterator_range.h
index c03ec723a2..9f4d02da29 100644
--- a/util/generic/iterator_range.h
+++ b/util/generic/iterator_range.h
@@ -5,44 +5,44 @@
#include <iterator>
#include <utility>
-template <typename TBegin, typename TEnd = TBegin>
-struct TIteratorRange {
- using TElement = std::remove_reference_t<decltype(*std::declval<TBegin>())>;
-
- TIteratorRange(TBegin begin, TEnd end)
- : Begin_(begin)
- , End_(end)
- {
- }
-
- TIteratorRange()
- : TIteratorRange(TBegin{}, TEnd{})
- {
- }
-
- TBegin begin() const {
- return Begin_;
- }
-
- TEnd end() const {
- return End_;
- }
-
- bool empty() const {
- // because range based for requires exactly '!='
- return !(Begin_ != End_);
- }
-
-private:
- TBegin Begin_;
- TEnd End_;
-};
-
-template <class TIterator>
-class TIteratorRange<TIterator, TIterator> {
+template <typename TBegin, typename TEnd = TBegin>
+struct TIteratorRange {
+ using TElement = std::remove_reference_t<decltype(*std::declval<TBegin>())>;
+
+ TIteratorRange(TBegin begin, TEnd end)
+ : Begin_(begin)
+ , End_(end)
+ {
+ }
+
+ TIteratorRange()
+ : TIteratorRange(TBegin{}, TEnd{})
+ {
+ }
+
+ TBegin begin() const {
+ return Begin_;
+ }
+
+ TEnd end() const {
+ return End_;
+ }
+
+ bool empty() const {
+ // because range based for requires exactly '!='
+ return !(Begin_ != End_);
+ }
+
+private:
+ TBegin Begin_;
+ TEnd End_;
+};
+
+template <class TIterator>
+class TIteratorRange<TIterator, TIterator> {
public:
- using iterator = TIterator;
- using const_iterator = TIterator;
+ using iterator = TIterator;
+ using const_iterator = TIterator;
using value_type = typename std::iterator_traits<iterator>::value_type;
using reference = typename std::iterator_traits<iterator>::reference;
using const_reference = typename std::iterator_traits<const_iterator>::reference;
@@ -55,17 +55,17 @@ public:
{
}
- TIteratorRange(TIterator begin, TIterator end)
+ TIteratorRange(TIterator begin, TIterator end)
: Begin_(begin)
, End_(end)
{
}
- TIterator begin() const {
+ TIterator begin() const {
return Begin_;
}
- TIterator end() const {
+ TIterator end() const {
return End_;
}
@@ -84,21 +84,21 @@ public:
}
private:
- TIterator Begin_;
- TIterator End_;
+ TIterator Begin_;
+ TIterator End_;
};
-template <class TIterator>
-TIteratorRange<TIterator> MakeIteratorRange(TIterator begin, TIterator end) {
- return TIteratorRange<TIterator>(begin, end);
+template <class TIterator>
+TIteratorRange<TIterator> MakeIteratorRange(TIterator begin, TIterator end) {
+ return TIteratorRange<TIterator>(begin, end);
+}
+
+template <class TIterator>
+TIteratorRange<TIterator> MakeIteratorRange(const std::pair<TIterator, TIterator>& range) {
+ return TIteratorRange<TIterator>(range.first, range.second);
}
-template <class TIterator>
-TIteratorRange<TIterator> MakeIteratorRange(const std::pair<TIterator, TIterator>& range) {
- return TIteratorRange<TIterator>(range.first, range.second);
+template <class TBegin, class TEnd>
+TIteratorRange<TBegin, TEnd> MakeIteratorRange(TBegin begin, TEnd end) {
+ return {begin, end};
}
-
-template <class TBegin, class TEnd>
-TIteratorRange<TBegin, TEnd> MakeIteratorRange(TBegin begin, TEnd end) {
- return {begin, end};
-}