16 #define KRATOS_DEFINE_RANGE(ITERATOR_TYPE, CONST) \
19 using value_type = typename std::iterator_traits<TIterator>::value_type; \
20 using pointer = typename std::iterator_traits<TIterator>::pointer; \
21 using reference = typename std::iterator_traits<TIterator>::reference; \
22 using size_type = std::size_t; \
24 Range() : mBegin(), mEnd() {} \
25 Range(ITERATOR_TYPE begin, ITERATOR_TYPE end) \
26 : mBegin(begin), mEnd(end) {} \
27 Range(Range&& rOther) noexcept = default; \
28 Range(const Range& rOther) noexcept = default; \
30 ITERATOR_TYPE begin() CONST noexcept {return mBegin;} \
31 ITERATOR_TYPE end() CONST noexcept {return mEnd;} \
32 size_type size() const noexcept {return std::distance(mBegin, mEnd);} \
33 bool empty() const noexcept {return mBegin == mEnd;} \
36 ITERATOR_TYPE mBegin; \
52 struct IsConstPointer<T*>
53 {
static constexpr
const bool value =
false;};
57 struct IsConstPointer<const T*>
58 {
static constexpr
const bool value =
true;};
61 template <
class TIterator>
62 struct IsConstIterator
64 static constexpr
const bool value = IsConstPointer<typename std::iterator_traits<TIterator>::pointer>::value;
80 template <
class TIterator,
class IsConstRange =
void>
89 template <
class TIterator>
90 class Range<TIterator, typename
std::enable_if<Detail::IsConstIterator<TIterator>::value>::type>
98 #undef KRATOS_DEFINE_RANGE
class Range KRATOS_DEFINE_RANGE(TIterator,)
Class representing a view into a subrange of a container.
Definition: MPIUtils.hpp:9
Definition: CheckpointID.hpp:68