mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
rbegin(), rend() 修正
reverse_iterator 修正
This commit is contained in:
parent
33fb2b72f4
commit
f5411a0336
4 changed files with 24 additions and 23 deletions
|
@ -9,6 +9,7 @@
|
||||||
#include <sprout/config.hpp>
|
#include <sprout/config.hpp>
|
||||||
#include <sprout/index_tuple.hpp>
|
#include <sprout/index_tuple.hpp>
|
||||||
#include <sprout/fixed_container/traits.hpp>
|
#include <sprout/fixed_container/traits.hpp>
|
||||||
|
#include <sprout/fixed_container/functions.hpp>
|
||||||
#include <sprout/detail/iterator.hpp>
|
#include <sprout/detail/iterator.hpp>
|
||||||
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
#include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ namespace sprout {
|
||||||
return N;
|
return N;
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR bool empty() const SPROUT_NOEXCEPT {
|
SPROUT_CONSTEXPR bool empty() const SPROUT_NOEXCEPT {
|
||||||
return N != 0;
|
return N == 0;
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR size_type max_size() const SPROUT_NOEXCEPT {
|
SPROUT_CONSTEXPR size_type max_size() const SPROUT_NOEXCEPT {
|
||||||
return size();
|
return size();
|
||||||
|
@ -69,23 +70,23 @@ namespace sprout {
|
||||||
return &elems[0] + size();
|
return &elems[0] + size();
|
||||||
}
|
}
|
||||||
reverse_iterator rbegin() SPROUT_NOEXCEPT {
|
reverse_iterator rbegin() SPROUT_NOEXCEPT {
|
||||||
return reverse_iterator(begin());
|
|
||||||
}
|
|
||||||
SPROUT_CONSTEXPR const_reverse_iterator rbegin() const SPROUT_NOEXCEPT {
|
|
||||||
return const_reverse_iterator(begin());
|
|
||||||
}
|
|
||||||
SPROUT_CONSTEXPR const_reverse_iterator crbegin() const SPROUT_NOEXCEPT {
|
|
||||||
return const_reverse_iterator(begin());
|
|
||||||
}
|
|
||||||
reverse_iterator rend() SPROUT_NOEXCEPT {
|
|
||||||
return reverse_iterator(end());
|
return reverse_iterator(end());
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR const_reverse_iterator rend() const SPROUT_NOEXCEPT {
|
SPROUT_CONSTEXPR const_reverse_iterator rbegin() const SPROUT_NOEXCEPT {
|
||||||
return const_reverse_iterator(end());
|
return const_reverse_iterator(end());
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR const_reverse_iterator crend() const SPROUT_NOEXCEPT {
|
SPROUT_CONSTEXPR const_reverse_iterator crbegin() const SPROUT_NOEXCEPT {
|
||||||
return const_reverse_iterator(end());
|
return const_reverse_iterator(end());
|
||||||
}
|
}
|
||||||
|
reverse_iterator rend() SPROUT_NOEXCEPT {
|
||||||
|
return reverse_iterator(begin());
|
||||||
|
}
|
||||||
|
SPROUT_CONSTEXPR const_reverse_iterator rend() const SPROUT_NOEXCEPT {
|
||||||
|
return const_reverse_iterator(begin());
|
||||||
|
}
|
||||||
|
SPROUT_CONSTEXPR const_reverse_iterator crend() const SPROUT_NOEXCEPT {
|
||||||
|
return const_reverse_iterator(begin());
|
||||||
|
}
|
||||||
reference operator[](size_type i) {
|
reference operator[](size_type i) {
|
||||||
return elems[i];
|
return elems[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,15 +75,15 @@ namespace sprout {
|
||||||
reverse_iterator(reverse_iterator const&) = default;
|
reverse_iterator(reverse_iterator const&) = default;
|
||||||
SPROUT_CONSTEXPR explicit reverse_iterator(iterator_type it)
|
SPROUT_CONSTEXPR explicit reverse_iterator(iterator_type it)
|
||||||
: current(it)
|
: current(it)
|
||||||
, deref_tmp(current - 1)
|
, deref_tmp(it - 1)
|
||||||
{}
|
{}
|
||||||
template<typename U>
|
template<typename U>
|
||||||
SPROUT_CONSTEXPR reverse_iterator(reverse_iterator<U> const& it)
|
SPROUT_CONSTEXPR reverse_iterator(reverse_iterator<U> const& it)
|
||||||
: current(it)
|
: current(it)
|
||||||
, deref_tmp(current - 1)
|
, deref_tmp(it - 1)
|
||||||
{}
|
{}
|
||||||
template<typename U>
|
template<typename U>
|
||||||
reverse_iterator& operator=(const reverse_iterator<U>& it) {
|
reverse_iterator& operator=(reverse_iterator<U> const& it) {
|
||||||
reverse_iterator temp(it);
|
reverse_iterator temp(it);
|
||||||
temp.swap(this);
|
temp.swap(this);
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace sprout {
|
||||||
return N;
|
return N;
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR bool empty() const SPROUT_NOEXCEPT {
|
SPROUT_CONSTEXPR bool empty() const SPROUT_NOEXCEPT {
|
||||||
return N != 0;
|
return N == 0;
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR size_type max_size() const SPROUT_NOEXCEPT {
|
SPROUT_CONSTEXPR size_type max_size() const SPROUT_NOEXCEPT {
|
||||||
return size();
|
return size();
|
||||||
|
@ -74,22 +74,22 @@ namespace sprout {
|
||||||
return &elems[0] + size();
|
return &elems[0] + size();
|
||||||
}
|
}
|
||||||
reverse_iterator rbegin() SPROUT_NOEXCEPT {
|
reverse_iterator rbegin() SPROUT_NOEXCEPT {
|
||||||
return reverse_iterator(begin());
|
return const_reverse_iterator(end());
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR const_reverse_iterator rbegin() const SPROUT_NOEXCEPT {
|
SPROUT_CONSTEXPR const_reverse_iterator rbegin() const SPROUT_NOEXCEPT {
|
||||||
return const_reverse_iterator(begin());
|
return const_reverse_iterator(end());
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR const_reverse_iterator crbegin() const SPROUT_NOEXCEPT {
|
SPROUT_CONSTEXPR const_reverse_iterator crbegin() const SPROUT_NOEXCEPT {
|
||||||
return const_reverse_iterator(begin());
|
return const_reverse_iterator(end());
|
||||||
}
|
}
|
||||||
reverse_iterator rend() SPROUT_NOEXCEPT {
|
reverse_iterator rend() SPROUT_NOEXCEPT {
|
||||||
return reverse_iterator(end());
|
return const_reverse_iterator(begin());
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR const_reverse_iterator rend() const SPROUT_NOEXCEPT {
|
SPROUT_CONSTEXPR const_reverse_iterator rend() const SPROUT_NOEXCEPT {
|
||||||
return const_reverse_iterator(end());
|
return const_reverse_iterator(begin());
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR const_reverse_iterator crend() const SPROUT_NOEXCEPT {
|
SPROUT_CONSTEXPR const_reverse_iterator crend() const SPROUT_NOEXCEPT {
|
||||||
return const_reverse_iterator(end());
|
return const_reverse_iterator(begin());
|
||||||
}
|
}
|
||||||
reference operator[](size_type i) {
|
reference operator[](size_type i) {
|
||||||
return elems[i];
|
return elems[i];
|
||||||
|
|
|
@ -279,7 +279,7 @@ namespace sprout {
|
||||||
return last_ - first_;
|
return last_ - first_;
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR bool empty() const {
|
SPROUT_CONSTEXPR bool empty() const {
|
||||||
return size() != 0;
|
return size() == 0;
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR size_type max_size() const {
|
SPROUT_CONSTEXPR size_type max_size() const {
|
||||||
return size();
|
return size();
|
||||||
|
|
Loading…
Reference in a new issue