Iros
 
Loading...
Searching...
No Matches
move_sentinel.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace di::container {
8template<concepts::Semiregular Sent>
9class MoveSentinel : public SentinelBase<MoveSentinel<Sent>> {
10public:
11 constexpr MoveSentinel() = default;
12 constexpr explicit MoveSentinel(Sent sentinel) : m_sentinel(sentinel) {}
13
14 template<concepts::Semiregular Other>
16 constexpr MoveSentinel(MoveSentinel<Other> const& other) : m_sentinel(other.base()) {}
17
18 template<concepts::Semiregular Other>
20 constexpr auto operator=(MoveSentinel<Other> const& other) -> MoveSentinel& {
21 this->m_sentinel = other.base();
22 return *this;
23 }
24
25 constexpr auto base() const -> Sent { return m_sentinel; }
26
27 template<typename It>
29 constexpr auto difference(MoveIterator<It> const& it) const {
30 return m_sentinel - it;
31 }
32
33private:
34 template<typename It>
36 constexpr friend auto operator==(MoveSentinel const& a, MoveIterator<It> const& b) -> bool {
37 return a.base() == b.base();
38 }
39
40 Sent m_sentinel {};
41};
42}
Definition move_iterator.h:24
constexpr auto base() const &-> Iter const &
Definition move_iterator.h:47
constexpr MoveSentinel()=default
constexpr auto operator=(MoveSentinel< Other > const &other) -> MoveSentinel &
Definition move_sentinel.h:20
constexpr auto base() const -> Sent
Definition move_sentinel.h:25
constexpr auto difference(MoveIterator< It > const &it) const
Definition move_sentinel.h:29
constexpr MoveSentinel(MoveSentinel< Other > const &other)
Definition move_sentinel.h:16
constexpr MoveSentinel(Sent sentinel)
Definition move_sentinel.h:12
Definition sentinel_base.h:13
Definition operations.h:19
Definition operations.h:99
Definition sentinel_for.h:9
Definition sized_sentinel_for.h:9
Definition sequence.h:12