mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
fix coding-stype
This commit is contained in:
parent
2012838899
commit
df3023db30
196 changed files with 2510 additions and 3945 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/endian_traits.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -89,10 +90,11 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR bytes_iterator prev() const {
|
||||
return bytes_iterator(it_, i_ - 1, prev_tag());
|
||||
}
|
||||
void swap(bytes_iterator& other) {
|
||||
using std::swap;
|
||||
swap(it_, other.it_);
|
||||
swap(i_, other.i_);
|
||||
void swap(bytes_iterator& other)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(it_, other.it_)))
|
||||
{
|
||||
sprout::swap(it_, other.it_);
|
||||
sprout::swap(i_, other.i_);
|
||||
}
|
||||
friend SPROUT_CONSTEXPR bool operator==(bytes_iterator const& lhs, bytes_iterator const& rhs) {
|
||||
return lhs.it_ == rhs.it_ && lhs.i_ == rhs.i_;
|
||||
|
@ -166,11 +168,13 @@ namespace sprout {
|
|||
// make_bytes_iterator
|
||||
//
|
||||
template<typename Iterator>
|
||||
inline SPROUT_CONSTEXPR sprout::bytes_iterator<Iterator> make_bytes_iterator(Iterator it) {
|
||||
inline SPROUT_CONSTEXPR sprout::bytes_iterator<Iterator>
|
||||
make_bytes_iterator(Iterator it) {
|
||||
return sprout::bytes_iterator<Iterator>(it);
|
||||
}
|
||||
template<typename Iterator, typename Traits>
|
||||
inline SPROUT_CONSTEXPR sprout::bytes_iterator<Iterator, Traits> make_bytes_iterator(Iterator it, Traits) {
|
||||
inline SPROUT_CONSTEXPR sprout::bytes_iterator<Iterator, Traits>
|
||||
make_bytes_iterator(Iterator it, Traits) {
|
||||
return sprout::bytes_iterator<Iterator, Traits>(it);
|
||||
}
|
||||
|
||||
|
@ -178,7 +182,10 @@ namespace sprout {
|
|||
// swap
|
||||
//
|
||||
template<typename Iterator, typename Traits>
|
||||
inline void swap(sprout::bytes_iterator<Iterator, Traits>& lhs, sprout::bytes_iterator<Iterator, Traits>& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) {
|
||||
inline void
|
||||
swap(sprout::bytes_iterator<Iterator, Traits>& lhs, sprout::bytes_iterator<Iterator, Traits>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
|
@ -187,11 +194,7 @@ namespace sprout {
|
|||
//
|
||||
template<typename Iterator, typename Traits>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<sprout::bytes_iterator<Iterator, Traits> >::difference_type
|
||||
iterator_distance(
|
||||
sprout::bytes_iterator<Iterator, Traits> first,
|
||||
sprout::bytes_iterator<Iterator, Traits> last
|
||||
)
|
||||
{
|
||||
iterator_distance(sprout::bytes_iterator<Iterator, Traits> first, sprout::bytes_iterator<Iterator, Traits> last) {
|
||||
return last - first;
|
||||
}
|
||||
|
||||
|
@ -199,14 +202,13 @@ namespace sprout {
|
|||
// iterator_next
|
||||
//
|
||||
template<typename Iterator, typename Traits>
|
||||
inline SPROUT_CONSTEXPR sprout::bytes_iterator<Iterator, Traits> iterator_next(
|
||||
sprout::bytes_iterator<Iterator, Traits> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::bytes_iterator<Iterator, Traits>
|
||||
iterator_next(sprout::bytes_iterator<Iterator, Traits> const& it) {
|
||||
return it.next();
|
||||
}
|
||||
template<typename Iterator, typename Traits>
|
||||
inline SPROUT_CONSTEXPR sprout::bytes_iterator<Iterator, Traits> iterator_next(
|
||||
inline SPROUT_CONSTEXPR sprout::bytes_iterator<Iterator, Traits>
|
||||
iterator_next(
|
||||
sprout::bytes_iterator<Iterator, Traits> const& it,
|
||||
typename sprout::bytes_iterator<Iterator, Traits>::difference_type n
|
||||
)
|
||||
|
@ -218,14 +220,13 @@ namespace sprout {
|
|||
// iterator_prev
|
||||
//
|
||||
template<typename Iterator, typename Traits>
|
||||
inline SPROUT_CONSTEXPR sprout::bytes_iterator<Iterator, Traits> iterator_prev(
|
||||
sprout::bytes_iterator<Iterator, Traits> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::bytes_iterator<Iterator, Traits>
|
||||
iterator_prev(sprout::bytes_iterator<Iterator, Traits> const& it) {
|
||||
return it.prev();
|
||||
}
|
||||
template<typename Iterator, typename Traits>
|
||||
inline SPROUT_CONSTEXPR sprout::bytes_iterator<Iterator, Traits> iterator_prev(
|
||||
inline SPROUT_CONSTEXPR sprout::bytes_iterator<Iterator, Traits>
|
||||
iterator_prev(
|
||||
sprout::bytes_iterator<Iterator, Traits> const& it,
|
||||
typename sprout::bytes_iterator<Iterator, Traits>::difference_type n
|
||||
)
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <sprout/iterator/next.hpp>
|
||||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -100,70 +101,51 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR counting_iterator prev() const {
|
||||
return counting_iterator(current_ - 1);
|
||||
}
|
||||
void swap(counting_iterator& other) {
|
||||
using std::swap;
|
||||
swap(current_, other.current_);
|
||||
void swap(counting_iterator& other)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(current_, other.current_)))
|
||||
{
|
||||
sprout::swap(current_, other.current_);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Incrementable1, typename Incrementable2>
|
||||
SPROUT_CONSTEXPR bool operator==(
|
||||
sprout::counting_iterator<Incrementable1> const& lhs,
|
||||
sprout::counting_iterator<Incrementable2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator==(sprout::counting_iterator<Incrementable1> const& lhs, sprout::counting_iterator<Incrementable2> const& rhs) {
|
||||
return *lhs == *rhs;
|
||||
}
|
||||
template<typename Incrementable1, typename Incrementable2>
|
||||
SPROUT_CONSTEXPR bool operator!=(
|
||||
sprout::counting_iterator<Incrementable1> const& lhs,
|
||||
sprout::counting_iterator<Incrementable2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator!=(sprout::counting_iterator<Incrementable1> const& lhs, sprout::counting_iterator<Incrementable2> const& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
template<typename Incrementable1, typename Incrementable2>
|
||||
SPROUT_CONSTEXPR bool operator<(
|
||||
sprout::counting_iterator<Incrementable1> const& lhs,
|
||||
sprout::counting_iterator<Incrementable2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator<(sprout::counting_iterator<Incrementable1> const& lhs, sprout::counting_iterator<Incrementable2> const& rhs) {
|
||||
return *lhs < *rhs;
|
||||
}
|
||||
template<typename Incrementable1, typename Incrementable2>
|
||||
SPROUT_CONSTEXPR bool operator>(
|
||||
sprout::counting_iterator<Incrementable1> const& lhs,
|
||||
sprout::counting_iterator<Incrementable2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator>(sprout::counting_iterator<Incrementable1> const& lhs, sprout::counting_iterator<Incrementable2> const& rhs) {
|
||||
return rhs < lhs;
|
||||
}
|
||||
template<typename Incrementable1, typename Incrementable2>
|
||||
SPROUT_CONSTEXPR bool operator<=(
|
||||
sprout::counting_iterator<Incrementable1> const& lhs,
|
||||
sprout::counting_iterator<Incrementable2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator<=(sprout::counting_iterator<Incrementable1> const& lhs, sprout::counting_iterator<Incrementable2> const& rhs) {
|
||||
return !(rhs < lhs);
|
||||
}
|
||||
template<typename Incrementable1, typename Incrementable2>
|
||||
SPROUT_CONSTEXPR bool operator>=(
|
||||
sprout::counting_iterator<Incrementable1> const& lhs,
|
||||
sprout::counting_iterator<Incrementable2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator>=(sprout::counting_iterator<Incrementable1> const& lhs, sprout::counting_iterator<Incrementable2> const& rhs) {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
template<typename Incrementable1, typename Incrementable2>
|
||||
SPROUT_CONSTEXPR typename sprout::counting_iterator<Incrementable1>::difference_type operator-(
|
||||
sprout::counting_iterator<Incrementable1> const& lhs,
|
||||
sprout::counting_iterator<Incrementable2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR typename sprout::counting_iterator<Incrementable1>::difference_type
|
||||
operator-(sprout::counting_iterator<Incrementable1> const& lhs, sprout::counting_iterator<Incrementable2> const& rhs) {
|
||||
return static_cast<typename sprout::counting_iterator<Incrementable1>::difference_type>(*lhs - *rhs);
|
||||
}
|
||||
template<typename Incrementable>
|
||||
SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable> operator+(
|
||||
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable>
|
||||
operator+(
|
||||
typename sprout::counting_iterator<Incrementable>::difference_type n,
|
||||
sprout::counting_iterator<Incrementable> const& it
|
||||
)
|
||||
|
@ -175,7 +157,7 @@ namespace sprout {
|
|||
// make_counting_iterator
|
||||
//
|
||||
template<typename Incrementable>
|
||||
SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable>
|
||||
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable>
|
||||
make_counting_iterator(Incrementable const& v) {
|
||||
return sprout::counting_iterator<Incrementable>(v);
|
||||
}
|
||||
|
@ -184,7 +166,8 @@ namespace sprout {
|
|||
// swap
|
||||
//
|
||||
template<typename Incrementable>
|
||||
inline void swap(sprout::counting_iterator<Incrementable>& lhs, sprout::counting_iterator<Incrementable>& rhs)
|
||||
inline void
|
||||
swap(sprout::counting_iterator<Incrementable>& lhs, sprout::counting_iterator<Incrementable>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
|
@ -195,11 +178,7 @@ namespace sprout {
|
|||
//
|
||||
template<typename Incrementable>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<sprout::counting_iterator<Incrementable> >::difference_type
|
||||
iterator_distance(
|
||||
sprout::counting_iterator<Incrementable> first,
|
||||
sprout::counting_iterator<Incrementable> last
|
||||
)
|
||||
{
|
||||
iterator_distance(sprout::counting_iterator<Incrementable> first, sprout::counting_iterator<Incrementable> last) {
|
||||
return last - first;
|
||||
}
|
||||
|
||||
|
@ -207,14 +186,13 @@ namespace sprout {
|
|||
// iterator_next
|
||||
//
|
||||
template<typename Incrementable>
|
||||
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable> iterator_next(
|
||||
sprout::counting_iterator<Incrementable> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable>
|
||||
iterator_next(sprout::counting_iterator<Incrementable> const& it) {
|
||||
return it.next();
|
||||
}
|
||||
template<typename Incrementable>
|
||||
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable> iterator_next(
|
||||
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable>
|
||||
iterator_next(
|
||||
sprout::counting_iterator<Incrementable> const& it,
|
||||
typename sprout::counting_iterator<Incrementable>::difference_type n
|
||||
)
|
||||
|
@ -226,14 +204,13 @@ namespace sprout {
|
|||
// iterator_prev
|
||||
//
|
||||
template<typename Incrementable>
|
||||
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable> iterator_prev(
|
||||
sprout::counting_iterator<Incrementable> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable>
|
||||
iterator_prev(sprout::counting_iterator<Incrementable> const& it) {
|
||||
return it.prev();
|
||||
}
|
||||
template<typename Incrementable>
|
||||
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable> iterator_prev(
|
||||
inline SPROUT_CONSTEXPR sprout::counting_iterator<Incrementable>
|
||||
iterator_prev(
|
||||
sprout::counting_iterator<Incrementable> const& it,
|
||||
typename sprout::counting_iterator<Incrementable>::difference_type n
|
||||
)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <sprout/iterator/next.hpp>
|
||||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/algorithm/find_if.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -134,11 +135,16 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR filter_iterator prev() const {
|
||||
return filter_iterator(pred, find_prev(sprout::prev(current), pred), last, private_constructor_tag());
|
||||
}
|
||||
void swap(filter_iterator& other) {
|
||||
using std::swap;
|
||||
swap(current, other.current);
|
||||
swap(last, other.last);
|
||||
swap(pred, other.pred);
|
||||
void swap(filter_iterator& other)
|
||||
SPROUT_NOEXCEPT_EXPR(
|
||||
SPROUT_NOEXCEPT_EXPR(sprout::swap(current, other.current))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(last, other.last))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(pred, other.pred))
|
||||
)
|
||||
{
|
||||
sprout::swap(current, other.current);
|
||||
sprout::swap(last, other.last);
|
||||
sprout::swap(pred, other.pred);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -172,7 +178,10 @@ namespace sprout {
|
|||
// swap
|
||||
//
|
||||
template<typename Predicate, typename Iterator>
|
||||
inline void swap(sprout::filter_iterator<Predicate, Iterator>& lhs, sprout::filter_iterator<Predicate, Iterator>& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) {
|
||||
inline void
|
||||
swap(sprout::filter_iterator<Predicate, Iterator>& lhs, sprout::filter_iterator<Predicate, Iterator>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
|
@ -180,10 +189,8 @@ namespace sprout {
|
|||
// iterator_next
|
||||
//
|
||||
template<typename Predicate, typename Iterator>
|
||||
inline SPROUT_CONSTEXPR sprout::filter_iterator<Predicate, Iterator> iterator_next(
|
||||
sprout::filter_iterator<Predicate, Iterator> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::filter_iterator<Predicate, Iterator>
|
||||
iterator_next(sprout::filter_iterator<Predicate, Iterator> const& it) {
|
||||
return it.next();
|
||||
}
|
||||
|
||||
|
@ -191,10 +198,8 @@ namespace sprout {
|
|||
// iterator_prev
|
||||
//
|
||||
template<typename Predicate, typename Iterator>
|
||||
inline SPROUT_CONSTEXPR sprout::filter_iterator<Predicate, Iterator> iterator_prev(
|
||||
sprout::filter_iterator<Predicate, Iterator> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::filter_iterator<Predicate, Iterator>
|
||||
iterator_prev(sprout::filter_iterator<Predicate, Iterator> const& it) {
|
||||
return it.prev();
|
||||
}
|
||||
} // namespace sprout
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/generator/functions.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -69,10 +70,11 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR generator_iterator next_generator() const {
|
||||
return (*this)();
|
||||
}
|
||||
void swap(generator_iterator& other) {
|
||||
using std::swap;
|
||||
swap(gen_, other.gen_);
|
||||
swap(count_, other.count_);
|
||||
void swap(generator_iterator& other)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(gen_, other.gen_)))
|
||||
{
|
||||
sprout::swap(gen_, other.gen_);
|
||||
sprout::swap(count_, other.count_);
|
||||
}
|
||||
friend SPROUT_CONSTEXPR bool operator==(generator_iterator const& lhs, generator_iterator const& rhs) {
|
||||
return lhs.count_ == rhs.count_;
|
||||
|
@ -124,10 +126,9 @@ namespace sprout {
|
|||
// swap
|
||||
//
|
||||
template<typename Generator>
|
||||
void swap(
|
||||
sprout::generator_iterator<Generator>& lhs,
|
||||
sprout::generator_iterator<Generator>& rhs
|
||||
)
|
||||
inline void
|
||||
swap(sprout::generator_iterator<Generator>& lhs, sprout::generator_iterator<Generator>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
@ -137,11 +138,7 @@ namespace sprout {
|
|||
//
|
||||
template<typename Generator>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<sprout::generator_iterator<Generator> >::difference_type
|
||||
iterator_distance(
|
||||
sprout::generator_iterator<Generator> first,
|
||||
sprout::generator_iterator<Generator> last
|
||||
)
|
||||
{
|
||||
iterator_distance(sprout::generator_iterator<Generator> first, sprout::generator_iterator<Generator> last) {
|
||||
return last - first;
|
||||
}
|
||||
|
||||
|
@ -149,10 +146,8 @@ namespace sprout {
|
|||
// iterator_next
|
||||
//
|
||||
template<typename Generator>
|
||||
SPROUT_CONSTEXPR sprout::generator_iterator<Generator> iterator_next(
|
||||
sprout::generator_iterator<Generator> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::generator_iterator<Generator>
|
||||
iterator_next(sprout::generator_iterator<Generator> const& it) {
|
||||
return it.next();
|
||||
}
|
||||
} // namespace sprout
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/utility/value_holder.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -91,10 +92,11 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR index_iterator prev() const {
|
||||
return index_iterator(holder_, index_ - 1);
|
||||
}
|
||||
void swap(index_iterator& other) {
|
||||
using std::swap;
|
||||
swap(holder_, other.holder_);
|
||||
swap(index_, other.index_);
|
||||
void swap(index_iterator& other)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(holder_, other.holder_)))
|
||||
{
|
||||
sprout::swap(holder_, other.holder_);
|
||||
sprout::swap(index_, other.index_);
|
||||
}
|
||||
friend SPROUT_CONSTEXPR bool operator==(index_iterator const& lhs, index_iterator const& rhs) {
|
||||
return lhs.index_ == rhs.index_;
|
||||
|
@ -171,7 +173,10 @@ namespace sprout {
|
|||
// swap
|
||||
//
|
||||
template<typename Container>
|
||||
inline void swap(sprout::index_iterator<Container>& lhs, sprout::index_iterator<Container>& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) {
|
||||
inline void
|
||||
swap(sprout::index_iterator<Container>& lhs, sprout::index_iterator<Container>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
|
@ -200,11 +205,7 @@ namespace sprout {
|
|||
//
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<sprout::index_iterator<Container> >::difference_type
|
||||
iterator_distance(
|
||||
sprout::index_iterator<Container> first,
|
||||
sprout::index_iterator<Container> last
|
||||
)
|
||||
{
|
||||
iterator_distance(sprout::index_iterator<Container> first, sprout::index_iterator<Container> last) {
|
||||
return last - first;
|
||||
}
|
||||
|
||||
|
@ -212,14 +213,13 @@ namespace sprout {
|
|||
// iterator_next
|
||||
//
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container> iterator_next(
|
||||
sprout::index_iterator<Container> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container>
|
||||
iterator_next(sprout::index_iterator<Container> const& it) {
|
||||
return it.next();
|
||||
}
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container> iterator_next(
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container>
|
||||
iterator_next(
|
||||
sprout::index_iterator<Container> const& it,
|
||||
typename sprout::index_iterator<Container>::difference_type n
|
||||
)
|
||||
|
@ -231,14 +231,13 @@ namespace sprout {
|
|||
// iterator_prev
|
||||
//
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container> iterator_prev(
|
||||
sprout::index_iterator<Container> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container>
|
||||
iterator_prev(sprout::index_iterator<Container> const& it) {
|
||||
return it.prev();
|
||||
}
|
||||
template<typename Container>
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container> iterator_prev(
|
||||
inline SPROUT_CONSTEXPR sprout::index_iterator<Container>
|
||||
iterator_prev(
|
||||
sprout::index_iterator<Container> const& it,
|
||||
typename sprout::index_iterator<Container>::difference_type n
|
||||
)
|
||||
|
|
|
@ -16,19 +16,13 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
std::is_literal_type<RandomAccessIterator>::value,
|
||||
RandomAccessIterator
|
||||
>::type next_impl(
|
||||
RandomAccessIterator const& it,
|
||||
std::random_access_iterator_tag*
|
||||
)
|
||||
{
|
||||
>::type
|
||||
next_impl(RandomAccessIterator const& it, std::random_access_iterator_tag*) {
|
||||
return it + 1;
|
||||
}
|
||||
template<typename ForwardIterator>
|
||||
inline SPROUT_CONSTEXPR ForwardIterator next_impl(
|
||||
ForwardIterator const& it,
|
||||
void*
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR ForwardIterator
|
||||
next_impl(ForwardIterator const& it, void*) {
|
||||
return std::next(it);
|
||||
}
|
||||
|
||||
|
@ -36,18 +30,18 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
std::is_literal_type<RandomAccessIterator>::value,
|
||||
RandomAccessIterator
|
||||
>::type next_impl(
|
||||
RandomAccessIterator const& it,
|
||||
typename std::iterator_traits<RandomAccessIterator>::difference_type n,
|
||||
>::type
|
||||
next_impl(
|
||||
RandomAccessIterator const& it, typename std::iterator_traits<RandomAccessIterator>::difference_type n,
|
||||
std::random_access_iterator_tag*
|
||||
)
|
||||
{
|
||||
return it + n;
|
||||
}
|
||||
template<typename ForwardIterator>
|
||||
inline SPROUT_CONSTEXPR ForwardIterator next_impl(
|
||||
ForwardIterator const& it,
|
||||
typename std::iterator_traits<ForwardIterator>::difference_type n,
|
||||
inline SPROUT_CONSTEXPR ForwardIterator
|
||||
next_impl(
|
||||
ForwardIterator const& it, typename std::iterator_traits<ForwardIterator>::difference_type n,
|
||||
void*
|
||||
)
|
||||
{
|
||||
|
|
|
@ -16,19 +16,13 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
std::is_literal_type<RandomAccessIterator>::value,
|
||||
RandomAccessIterator
|
||||
>::type prev_impl(
|
||||
RandomAccessIterator const& it,
|
||||
std::random_access_iterator_tag*
|
||||
)
|
||||
{
|
||||
>::type
|
||||
prev_impl(RandomAccessIterator const& it, std::random_access_iterator_tag*) {
|
||||
return it - 1;
|
||||
}
|
||||
template<typename BidirectionalIterator>
|
||||
inline SPROUT_CONSTEXPR BidirectionalIterator prev_impl(
|
||||
BidirectionalIterator const& it,
|
||||
void*
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR BidirectionalIterator
|
||||
prev_impl(BidirectionalIterator const& it, void*) {
|
||||
return std::prev(it);
|
||||
}
|
||||
|
||||
|
@ -36,18 +30,18 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR typename std::enable_if<
|
||||
std::is_literal_type<RandomAccessIterator>::value,
|
||||
RandomAccessIterator
|
||||
>::type prev_impl(
|
||||
RandomAccessIterator const& it,
|
||||
typename std::iterator_traits<RandomAccessIterator>::difference_type n,
|
||||
>::type
|
||||
prev_impl(
|
||||
RandomAccessIterator const& it, typename std::iterator_traits<RandomAccessIterator>::difference_type n,
|
||||
std::random_access_iterator_tag*
|
||||
)
|
||||
{
|
||||
return it - n;
|
||||
}
|
||||
template<typename BidirectionalIterator>
|
||||
inline SPROUT_CONSTEXPR BidirectionalIterator prev_impl(
|
||||
BidirectionalIterator const& it,
|
||||
typename std::iterator_traits<BidirectionalIterator>::difference_type n,
|
||||
inline SPROUT_CONSTEXPR BidirectionalIterator
|
||||
prev_impl(
|
||||
BidirectionalIterator const& it, typename std::iterator_traits<BidirectionalIterator>::difference_type n,
|
||||
void*
|
||||
)
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <sprout/iterator/next.hpp>
|
||||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -110,71 +111,55 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR reverse_iterator prev() const {
|
||||
return reverse_iterator(sprout::next(current));
|
||||
}
|
||||
void swap(reverse_iterator& other) {
|
||||
using std::swap;
|
||||
void swap(reverse_iterator& other)
|
||||
SPROUT_NOEXCEPT_EXPR(
|
||||
SPROUT_NOEXCEPT_EXPR(swap(current, other.current))
|
||||
&& SPROUT_NOEXCEPT_EXPR(swap(deref_tmp, other.deref_tmp))
|
||||
)
|
||||
{
|
||||
swap(current, other.current);
|
||||
swap(deref_tmp, other.deref_tmp);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Iterator1, typename Iterator2>
|
||||
inline SPROUT_CONSTEXPR bool operator==(
|
||||
sprout::reverse_iterator<Iterator1> const& lhs,
|
||||
sprout::reverse_iterator<Iterator2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator==(sprout::reverse_iterator<Iterator1> const& lhs, sprout::reverse_iterator<Iterator2> const& rhs) {
|
||||
return lhs.base() == rhs.base();
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2>
|
||||
inline SPROUT_CONSTEXPR bool operator!=(
|
||||
sprout::reverse_iterator<Iterator1> const& lhs,
|
||||
sprout::reverse_iterator<Iterator2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator!=(sprout::reverse_iterator<Iterator1> const& lhs, sprout::reverse_iterator<Iterator2> const& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2>
|
||||
inline SPROUT_CONSTEXPR bool operator<(
|
||||
sprout::reverse_iterator<Iterator1> const& lhs,
|
||||
sprout::reverse_iterator<Iterator2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator<(sprout::reverse_iterator<Iterator1> const& lhs, sprout::reverse_iterator<Iterator2> const& rhs) {
|
||||
return lhs.base() < rhs.base();
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2>
|
||||
inline SPROUT_CONSTEXPR bool operator>(
|
||||
sprout::reverse_iterator<Iterator1> const& lhs,
|
||||
sprout::reverse_iterator<Iterator2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator>(sprout::reverse_iterator<Iterator1> const& lhs, sprout::reverse_iterator<Iterator2> const& rhs) {
|
||||
return rhs < lhs;
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2>
|
||||
inline SPROUT_CONSTEXPR bool operator<=(
|
||||
sprout::reverse_iterator<Iterator1> const& lhs,
|
||||
sprout::reverse_iterator<Iterator2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator<=(sprout::reverse_iterator<Iterator1> const& lhs, sprout::reverse_iterator<Iterator2> const& rhs) {
|
||||
return !(rhs < lhs);
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2>
|
||||
inline SPROUT_CONSTEXPR bool operator>=(
|
||||
sprout::reverse_iterator<Iterator1> const& lhs,
|
||||
sprout::reverse_iterator<Iterator2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator>=(sprout::reverse_iterator<Iterator1> const& lhs, sprout::reverse_iterator<Iterator2> const& rhs) {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2>
|
||||
inline SPROUT_CONSTEXPR decltype(std::declval<Iterator1>() - std::declval<Iterator2>()) operator-(
|
||||
sprout::reverse_iterator<Iterator1> const& lhs,
|
||||
sprout::reverse_iterator<Iterator2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR decltype(std::declval<Iterator1>() - std::declval<Iterator2>())
|
||||
operator-(sprout::reverse_iterator<Iterator1> const& lhs, sprout::reverse_iterator<Iterator2> const& rhs) {
|
||||
return lhs.base() - rhs.base();
|
||||
}
|
||||
template<typename Iterator>
|
||||
inline SPROUT_CONSTEXPR sprout::reverse_iterator<Iterator> operator+(
|
||||
inline SPROUT_CONSTEXPR sprout::reverse_iterator<Iterator>
|
||||
operator+(
|
||||
typename sprout::reverse_iterator<Iterator>::difference_type n,
|
||||
sprout::reverse_iterator<Iterator> const& it
|
||||
)
|
||||
|
@ -195,7 +180,10 @@ namespace sprout {
|
|||
// swap
|
||||
//
|
||||
template<typename Iterator>
|
||||
inline void swap(sprout::reverse_iterator<Iterator>& lhs, sprout::reverse_iterator<Iterator>& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) {
|
||||
inline void
|
||||
swap(sprout::reverse_iterator<Iterator>& lhs, sprout::reverse_iterator<Iterator>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
|
@ -204,11 +192,7 @@ namespace sprout {
|
|||
//
|
||||
template<typename Iterator>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<sprout::reverse_iterator<Iterator> >::difference_type
|
||||
iterator_distance(
|
||||
sprout::reverse_iterator<Iterator> first,
|
||||
sprout::reverse_iterator<Iterator> last
|
||||
)
|
||||
{
|
||||
iterator_distance(sprout::reverse_iterator<Iterator> first, sprout::reverse_iterator<Iterator> last) {
|
||||
return last - first;
|
||||
}
|
||||
|
||||
|
@ -216,14 +200,13 @@ namespace sprout {
|
|||
// iterator_next
|
||||
//
|
||||
template<typename Iterator>
|
||||
inline SPROUT_CONSTEXPR sprout::reverse_iterator<Iterator> iterator_next(
|
||||
sprout::reverse_iterator<Iterator> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::reverse_iterator<Iterator>
|
||||
iterator_next(sprout::reverse_iterator<Iterator> const& it) {
|
||||
return it.next();
|
||||
}
|
||||
template<typename Iterator>
|
||||
inline SPROUT_CONSTEXPR sprout::reverse_iterator<Iterator> iterator_next(
|
||||
inline SPROUT_CONSTEXPR sprout::reverse_iterator<Iterator>
|
||||
iterator_next(
|
||||
sprout::reverse_iterator<Iterator> const& it,
|
||||
typename sprout::reverse_iterator<Iterator>::difference_type n
|
||||
)
|
||||
|
@ -235,14 +218,13 @@ namespace sprout {
|
|||
// iterator_prev
|
||||
//
|
||||
template<typename Iterator>
|
||||
inline SPROUT_CONSTEXPR sprout::reverse_iterator<Iterator> iterator_prev(
|
||||
sprout::reverse_iterator<Iterator> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::reverse_iterator<Iterator>
|
||||
iterator_prev(sprout::reverse_iterator<Iterator> const& it) {
|
||||
return it.prev();
|
||||
}
|
||||
template<typename Iterator>
|
||||
inline SPROUT_CONSTEXPR sprout::reverse_iterator<Iterator> iterator_prev(
|
||||
inline SPROUT_CONSTEXPR sprout::reverse_iterator<Iterator>
|
||||
iterator_prev(
|
||||
sprout::reverse_iterator<Iterator> const& it,
|
||||
typename sprout::reverse_iterator<Iterator>::difference_type n
|
||||
)
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/numeric/dft/fixed/sawtooth.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -136,77 +137,52 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR sawtooth_iterator prev() const {
|
||||
return sawtooth_iterator(*this, index_ - 1);
|
||||
}
|
||||
void swap(sawtooth_iterator& other) {
|
||||
using std::swap;
|
||||
swap(index_, other.index_);
|
||||
swap(frequency_, other.frequency_);
|
||||
swap(amplitude_, other.amplitude_);
|
||||
swap(phase_, other.phase_);
|
||||
void swap(sawtooth_iterator& other) SPROUT_NOEXCEPT {
|
||||
sprout::swap(index_, other.index_);
|
||||
sprout::swap(frequency_, other.frequency_);
|
||||
sprout::swap(amplitude_, other.amplitude_);
|
||||
sprout::swap(phase_, other.phase_);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator==(
|
||||
sprout::sawtooth_iterator<Value1> const& lhs,
|
||||
sprout::sawtooth_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator==(sprout::sawtooth_iterator<Value1> const& lhs, sprout::sawtooth_iterator<Value2> const& rhs) {
|
||||
return lhs.index() == rhs.index();
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator!=(
|
||||
sprout::sawtooth_iterator<Value1> const& lhs,
|
||||
sprout::sawtooth_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator!=(sprout::sawtooth_iterator<Value1> const& lhs, sprout::sawtooth_iterator<Value2> const& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator<(
|
||||
sprout::sawtooth_iterator<Value1> const& lhs,
|
||||
sprout::sawtooth_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator<(sprout::sawtooth_iterator<Value1> const& lhs, sprout::sawtooth_iterator<Value2> const& rhs) {
|
||||
return lhs.index() < rhs.index();
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator>(
|
||||
sprout::sawtooth_iterator<Value1> const& lhs,
|
||||
sprout::sawtooth_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator>(sprout::sawtooth_iterator<Value1> const& lhs, sprout::sawtooth_iterator<Value2> const& rhs) {
|
||||
return rhs < lhs;
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator<=(
|
||||
sprout::sawtooth_iterator<Value1> const& lhs,
|
||||
sprout::sawtooth_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator<=(sprout::sawtooth_iterator<Value1> const& lhs, sprout::sawtooth_iterator<Value2> const& rhs) {
|
||||
return !(rhs < lhs);
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator>=(
|
||||
sprout::sawtooth_iterator<Value1> const& lhs,
|
||||
sprout::sawtooth_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator>=(sprout::sawtooth_iterator<Value1> const& lhs, sprout::sawtooth_iterator<Value2> const& rhs) {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR typename sprout::sawtooth_iterator<Value1>::difference_type operator-(
|
||||
sprout::sawtooth_iterator<Value1> const& lhs,
|
||||
sprout::sawtooth_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR typename sprout::sawtooth_iterator<Value1>::difference_type
|
||||
operator-(sprout::sawtooth_iterator<Value1> const& lhs, sprout::sawtooth_iterator<Value2> const& rhs) {
|
||||
return lhs.index() - rhs.index();
|
||||
}
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::sawtooth_iterator<Value> operator+(
|
||||
typename sprout::sawtooth_iterator<Value>::difference_type n,
|
||||
sprout::sawtooth_iterator<Value> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::sawtooth_iterator<Value>
|
||||
operator+(typename sprout::sawtooth_iterator<Value>::difference_type n, sprout::sawtooth_iterator<Value> const& it) {
|
||||
return it + n;
|
||||
}
|
||||
|
||||
|
@ -214,7 +190,10 @@ namespace sprout {
|
|||
// swap
|
||||
//
|
||||
template<typename Value>
|
||||
inline void swap(sprout::sawtooth_iterator<Value>& lhs, sprout::sawtooth_iterator<Value>& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) {
|
||||
inline void
|
||||
swap(sprout::sawtooth_iterator<Value>& lhs, sprout::sawtooth_iterator<Value>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
|
@ -223,11 +202,7 @@ namespace sprout {
|
|||
//
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<sprout::sawtooth_iterator<Value> >::difference_type
|
||||
iterator_distance(
|
||||
sprout::sawtooth_iterator<Value> first,
|
||||
sprout::sawtooth_iterator<Value> last
|
||||
)
|
||||
{
|
||||
iterator_distance(sprout::sawtooth_iterator<Value> first, sprout::sawtooth_iterator<Value> last) {
|
||||
return last - first;
|
||||
}
|
||||
|
||||
|
@ -235,18 +210,13 @@ namespace sprout {
|
|||
// iterator_next
|
||||
//
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::sawtooth_iterator<Value> iterator_next(
|
||||
sprout::sawtooth_iterator<Value> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::sawtooth_iterator<Value>
|
||||
iterator_next(sprout::sawtooth_iterator<Value> const& it) {
|
||||
return it.next();
|
||||
}
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::sawtooth_iterator<Value> iterator_next(
|
||||
sprout::sawtooth_iterator<Value> const& it,
|
||||
typename sprout::sawtooth_iterator<Value>::difference_type n
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::sawtooth_iterator<Value>
|
||||
iterator_next(sprout::sawtooth_iterator<Value> const& it, typename sprout::sawtooth_iterator<Value>::difference_type n) {
|
||||
return it + n;
|
||||
}
|
||||
|
||||
|
@ -254,18 +224,13 @@ namespace sprout {
|
|||
// iterator_prev
|
||||
//
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::sawtooth_iterator<Value> iterator_prev(
|
||||
sprout::sawtooth_iterator<Value> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::sawtooth_iterator<Value>
|
||||
iterator_prev(sprout::sawtooth_iterator<Value> const& it) {
|
||||
return it.prev();
|
||||
}
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::sawtooth_iterator<Value> iterator_prev(
|
||||
sprout::sawtooth_iterator<Value> const& it,
|
||||
typename sprout::sawtooth_iterator<Value>::difference_type n
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::sawtooth_iterator<Value>
|
||||
iterator_prev(sprout::sawtooth_iterator<Value> const& it, typename sprout::sawtooth_iterator<Value>::difference_type n) {
|
||||
return it - n;
|
||||
}
|
||||
} // namespace sprout
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/math/constants.hpp>
|
||||
#include <sprout/math/sin.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -144,78 +145,53 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR sinusoid_iterator prev() const {
|
||||
return sinusoid_iterator(*this, index_ - 1);
|
||||
}
|
||||
void swap(sinusoid_iterator& other) {
|
||||
using std::swap;
|
||||
swap(index_, other.index_);
|
||||
swap(frequency_, other.frequency_);
|
||||
swap(amplitude_, other.amplitude_);
|
||||
swap(phase_, other.phase_);
|
||||
swap(d_, other.d_);
|
||||
void swap(sinusoid_iterator& other) SPROUT_NOEXCEPT {
|
||||
sprout::swap(index_, other.index_);
|
||||
sprout::swap(frequency_, other.frequency_);
|
||||
sprout::swap(amplitude_, other.amplitude_);
|
||||
sprout::swap(phase_, other.phase_);
|
||||
sprout::swap(d_, other.d_);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator==(
|
||||
sprout::sinusoid_iterator<Value1> const& lhs,
|
||||
sprout::sinusoid_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator==(sprout::sinusoid_iterator<Value1> const& lhs, sprout::sinusoid_iterator<Value2> const& rhs) {
|
||||
return lhs.index() == rhs.index();
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator!=(
|
||||
sprout::sinusoid_iterator<Value1> const& lhs,
|
||||
sprout::sinusoid_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator!=(sprout::sinusoid_iterator<Value1> const& lhs, sprout::sinusoid_iterator<Value2> const& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator<(
|
||||
sprout::sinusoid_iterator<Value1> const& lhs,
|
||||
sprout::sinusoid_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator<(sprout::sinusoid_iterator<Value1> const& lhs, sprout::sinusoid_iterator<Value2> const& rhs) {
|
||||
return lhs.index() < rhs.index();
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator>(
|
||||
sprout::sinusoid_iterator<Value1> const& lhs,
|
||||
sprout::sinusoid_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator>(sprout::sinusoid_iterator<Value1> const& lhs, sprout::sinusoid_iterator<Value2> const& rhs) {
|
||||
return rhs < lhs;
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator<=(
|
||||
sprout::sinusoid_iterator<Value1> const& lhs,
|
||||
sprout::sinusoid_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator<=(sprout::sinusoid_iterator<Value1> const& lhs, sprout::sinusoid_iterator<Value2> const& rhs) {
|
||||
return !(rhs < lhs);
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator>=(
|
||||
sprout::sinusoid_iterator<Value1> const& lhs,
|
||||
sprout::sinusoid_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator>=(sprout::sinusoid_iterator<Value1> const& lhs, sprout::sinusoid_iterator<Value2> const& rhs) {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR typename sprout::sinusoid_iterator<Value1>::difference_type operator-(
|
||||
sprout::sinusoid_iterator<Value1> const& lhs,
|
||||
sprout::sinusoid_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR typename sprout::sinusoid_iterator<Value1>::difference_type
|
||||
operator-(sprout::sinusoid_iterator<Value1> const& lhs, sprout::sinusoid_iterator<Value2> const& rhs) {
|
||||
return lhs.index() - rhs.index();
|
||||
}
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::sinusoid_iterator<Value> operator+(
|
||||
typename sprout::sinusoid_iterator<Value>::difference_type n,
|
||||
sprout::sinusoid_iterator<Value> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::sinusoid_iterator<Value>
|
||||
operator+(typename sprout::sinusoid_iterator<Value>::difference_type n, sprout::sinusoid_iterator<Value> const& it) {
|
||||
return it + n;
|
||||
}
|
||||
|
||||
|
@ -223,7 +199,10 @@ namespace sprout {
|
|||
// swap
|
||||
//
|
||||
template<typename Value>
|
||||
inline void swap(sprout::sinusoid_iterator<Value>& lhs, sprout::sinusoid_iterator<Value>& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) {
|
||||
inline void
|
||||
swap(sprout::sinusoid_iterator<Value>& lhs, sprout::sinusoid_iterator<Value>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
|
@ -232,11 +211,7 @@ namespace sprout {
|
|||
//
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<sprout::sinusoid_iterator<Value> >::difference_type
|
||||
iterator_distance(
|
||||
sprout::sinusoid_iterator<Value> first,
|
||||
sprout::sinusoid_iterator<Value> last
|
||||
)
|
||||
{
|
||||
iterator_distance(sprout::sinusoid_iterator<Value> first, sprout::sinusoid_iterator<Value> last) {
|
||||
return last - first;
|
||||
}
|
||||
|
||||
|
@ -244,18 +219,13 @@ namespace sprout {
|
|||
// iterator_next
|
||||
//
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::sinusoid_iterator<Value> iterator_next(
|
||||
sprout::sinusoid_iterator<Value> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::sinusoid_iterator<Value>
|
||||
iterator_next(sprout::sinusoid_iterator<Value> const& it) {
|
||||
return it.next();
|
||||
}
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::sinusoid_iterator<Value> iterator_next(
|
||||
sprout::sinusoid_iterator<Value> const& it,
|
||||
typename sprout::sinusoid_iterator<Value>::difference_type n
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::sinusoid_iterator<Value>
|
||||
iterator_next(sprout::sinusoid_iterator<Value> const& it, typename sprout::sinusoid_iterator<Value>::difference_type n) {
|
||||
return it + n;
|
||||
}
|
||||
|
||||
|
@ -263,18 +233,13 @@ namespace sprout {
|
|||
// iterator_prev
|
||||
//
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::sinusoid_iterator<Value> iterator_prev(
|
||||
sprout::sinusoid_iterator<Value> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::sinusoid_iterator<Value>
|
||||
iterator_prev(sprout::sinusoid_iterator<Value> const& it) {
|
||||
return it.prev();
|
||||
}
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::sinusoid_iterator<Value> iterator_prev(
|
||||
sprout::sinusoid_iterator<Value> const& it,
|
||||
typename sprout::sinusoid_iterator<Value>::difference_type n
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::sinusoid_iterator<Value>
|
||||
iterator_prev(sprout::sinusoid_iterator<Value> const& it, typename sprout::sinusoid_iterator<Value>::difference_type n) {
|
||||
return it - n;
|
||||
}
|
||||
} // namespace sprout
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/container/size.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -112,9 +113,10 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR size_enum_iterator prev() const {
|
||||
return size_enum_iterator(sprout::prev(current));
|
||||
}
|
||||
void swap(size_enum_iterator& other) {
|
||||
using std::swap;
|
||||
swap(current, other.current);
|
||||
void swap(size_enum_iterator& other)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(current, other.current)))
|
||||
{
|
||||
sprout::swap(current, other.current);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -254,11 +256,12 @@ namespace sprout {
|
|||
: size_enum_iterator(sprout::prev(current), sep_size, true)
|
||||
;
|
||||
}
|
||||
void swap(size_enum_iterator& other) {
|
||||
using std::swap;
|
||||
swap(current, other.current);
|
||||
swap(sep_size, other.sep_size);
|
||||
swap(is_sep, other.is_sep);
|
||||
void swap(size_enum_iterator& other)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(current, other.current)))
|
||||
{
|
||||
sprout::swap(current, other.current);
|
||||
sprout::swap(sep_size, other.sep_size);
|
||||
sprout::swap(is_sep, other.is_sep);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -266,7 +269,8 @@ namespace sprout {
|
|||
typename Iterator1, bool Separated1,
|
||||
typename Iterator2, bool Separated2
|
||||
>
|
||||
inline SPROUT_CONSTEXPR bool operator==(
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator==(
|
||||
sprout::size_enum_iterator<Iterator1, Separated1> const& lhs,
|
||||
sprout::size_enum_iterator<Iterator2, Separated2> const& rhs
|
||||
)
|
||||
|
@ -277,7 +281,8 @@ namespace sprout {
|
|||
typename Iterator1, bool Separated1,
|
||||
typename Iterator2, bool Separated2
|
||||
>
|
||||
inline SPROUT_CONSTEXPR bool operator!=(
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator!=(
|
||||
sprout::size_enum_iterator<Iterator1, Separated1> const& lhs,
|
||||
sprout::size_enum_iterator<Iterator2, Separated2> const& rhs
|
||||
)
|
||||
|
@ -288,7 +293,8 @@ namespace sprout {
|
|||
typename Iterator1, bool Separated1,
|
||||
typename Iterator2, bool Separated2
|
||||
>
|
||||
inline SPROUT_CONSTEXPR bool operator<(
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator<(
|
||||
sprout::size_enum_iterator<Iterator1, Separated1> const& lhs,
|
||||
sprout::size_enum_iterator<Iterator2, Separated2> const& rhs
|
||||
)
|
||||
|
@ -301,7 +307,8 @@ namespace sprout {
|
|||
typename Iterator1, bool Separated1,
|
||||
typename Iterator2, bool Separated2
|
||||
>
|
||||
inline SPROUT_CONSTEXPR bool operator>(
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator>(
|
||||
sprout::size_enum_iterator<Iterator1, Separated1> const& lhs,
|
||||
sprout::size_enum_iterator<Iterator2, Separated2> const& rhs
|
||||
)
|
||||
|
@ -312,7 +319,8 @@ namespace sprout {
|
|||
typename Iterator1, bool Separated1,
|
||||
typename Iterator2, bool Separated2
|
||||
>
|
||||
inline SPROUT_CONSTEXPR bool operator<=(
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator<=(
|
||||
sprout::size_enum_iterator<Iterator1, Separated1> const& lhs,
|
||||
sprout::size_enum_iterator<Iterator2, Separated2> const& rhs
|
||||
)
|
||||
|
@ -323,7 +331,8 @@ namespace sprout {
|
|||
typename Iterator1, bool Separated1,
|
||||
typename Iterator2, bool Separated2
|
||||
>
|
||||
inline SPROUT_CONSTEXPR bool operator>=(
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator>=(
|
||||
sprout::size_enum_iterator<Iterator1, Separated1> const& lhs,
|
||||
sprout::size_enum_iterator<Iterator2, Separated2> const& rhs
|
||||
)
|
||||
|
@ -331,7 +340,8 @@ namespace sprout {
|
|||
return !(lhs < rhs);
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2>
|
||||
inline SPROUT_CONSTEXPR decltype(std::declval<Iterator1>() - std::declval<Iterator2>()) operator-(
|
||||
inline SPROUT_CONSTEXPR decltype(std::declval<Iterator1>() - std::declval<Iterator2>())
|
||||
operator-(
|
||||
sprout::size_enum_iterator<Iterator1> const& lhs,
|
||||
sprout::size_enum_iterator<Iterator2> const& rhs
|
||||
)
|
||||
|
@ -339,7 +349,8 @@ namespace sprout {
|
|||
return lhs.base() - rhs.base();
|
||||
}
|
||||
template<typename Iterator1, typename Iterator2>
|
||||
inline SPROUT_CONSTEXPR decltype(std::declval<Iterator1>() - std::declval<Iterator2>()) operator-(
|
||||
inline SPROUT_CONSTEXPR decltype(std::declval<Iterator1>() - std::declval<Iterator2>())
|
||||
operator-(
|
||||
sprout::size_enum_iterator<Iterator1, true> const& lhs,
|
||||
sprout::size_enum_iterator<Iterator2, true> const& rhs
|
||||
)
|
||||
|
@ -352,7 +363,8 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
template<typename Iterator, bool Separated>
|
||||
inline SPROUT_CONSTEXPR sprout::size_enum_iterator<Iterator, Separated> operator+(
|
||||
inline SPROUT_CONSTEXPR sprout::size_enum_iterator<Iterator, Separated>
|
||||
operator+(
|
||||
typename sprout::size_enum_iterator<Iterator, Separated>::difference_type n,
|
||||
sprout::size_enum_iterator<Iterator, Separated> const& it
|
||||
)
|
||||
|
@ -383,11 +395,8 @@ namespace sprout {
|
|||
// swap
|
||||
//
|
||||
template<typename Iterator, bool Separated>
|
||||
void swap(
|
||||
sprout::size_enum_iterator<Iterator, Separated>& lhs,
|
||||
sprout::size_enum_iterator<Iterator, Separated>& rhs
|
||||
)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
void swap(sprout::size_enum_iterator<Iterator, Separated>& lhs, sprout::size_enum_iterator<Iterator, Separated>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
@ -397,11 +406,7 @@ namespace sprout {
|
|||
//
|
||||
template<typename Iterator, bool Separated>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<sprout::size_enum_iterator<Iterator, Separated> >::difference_type
|
||||
iterator_distance(
|
||||
sprout::size_enum_iterator<Iterator, Separated> first,
|
||||
sprout::size_enum_iterator<Iterator, Separated> last
|
||||
)
|
||||
{
|
||||
iterator_distance(sprout::size_enum_iterator<Iterator, Separated> first, sprout::size_enum_iterator<Iterator, Separated> last) {
|
||||
return last - first;
|
||||
}
|
||||
|
||||
|
@ -409,14 +414,13 @@ namespace sprout {
|
|||
// iterator_next
|
||||
//
|
||||
template<typename Iterator, bool Separated>
|
||||
inline SPROUT_CONSTEXPR sprout::size_enum_iterator<Iterator, Separated> iterator_next(
|
||||
sprout::size_enum_iterator<Iterator, Separated> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::size_enum_iterator<Iterator, Separated>
|
||||
iterator_next(sprout::size_enum_iterator<Iterator, Separated> const& it) {
|
||||
return it.next();
|
||||
}
|
||||
template<typename Iterator, bool Separated>
|
||||
inline SPROUT_CONSTEXPR sprout::size_enum_iterator<Iterator, Separated> iterator_next(
|
||||
inline SPROUT_CONSTEXPR sprout::size_enum_iterator<Iterator, Separated>
|
||||
iterator_next(
|
||||
sprout::size_enum_iterator<Iterator, Separated> const& it,
|
||||
typename sprout::size_enum_iterator<Iterator, Separated>::difference_type n
|
||||
)
|
||||
|
@ -428,14 +432,13 @@ namespace sprout {
|
|||
// iterator_prev
|
||||
//
|
||||
template<typename Iterator, bool Separated>
|
||||
inline SPROUT_CONSTEXPR sprout::size_enum_iterator<Iterator, Separated> iterator_prev(
|
||||
sprout::size_enum_iterator<Iterator, Separated> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::size_enum_iterator<Iterator, Separated>
|
||||
iterator_prev(sprout::size_enum_iterator<Iterator, Separated> const& it) {
|
||||
return it.prev();
|
||||
}
|
||||
template<typename Iterator, bool Separated>
|
||||
inline SPROUT_CONSTEXPR sprout::size_enum_iterator<Iterator, Separated> iterator_prev(
|
||||
inline SPROUT_CONSTEXPR sprout::size_enum_iterator<Iterator, Separated>
|
||||
iterator_prev(
|
||||
sprout::size_enum_iterator<Iterator, Separated> const& it,
|
||||
typename sprout::size_enum_iterator<Iterator, Separated>::difference_type n
|
||||
)
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/numeric/dft/fixed/square.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -145,78 +146,53 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR square_iterator prev() const {
|
||||
return square_iterator(*this, index_ - 1);
|
||||
}
|
||||
void swap(square_iterator& other) {
|
||||
using std::swap;
|
||||
swap(index_, other.index_);
|
||||
swap(frequency_, other.frequency_);
|
||||
swap(amplitude_, other.amplitude_);
|
||||
swap(phase_, other.phase_);
|
||||
swap(duty_, other.duty_);
|
||||
void swap(square_iterator& other) SPROUT_NOEXCEPT {
|
||||
sprout::swap(index_, other.index_);
|
||||
sprout::swap(frequency_, other.frequency_);
|
||||
sprout::swap(amplitude_, other.amplitude_);
|
||||
sprout::swap(phase_, other.phase_);
|
||||
sprout::swap(duty_, other.duty_);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator==(
|
||||
sprout::square_iterator<Value1> const& lhs,
|
||||
sprout::square_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator==(sprout::square_iterator<Value1> const& lhs, sprout::square_iterator<Value2> const& rhs) {
|
||||
return lhs.index() == rhs.index();
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator!=(
|
||||
sprout::square_iterator<Value1> const& lhs,
|
||||
sprout::square_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator!=(sprout::square_iterator<Value1> const& lhs, sprout::square_iterator<Value2> const& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator<(
|
||||
sprout::square_iterator<Value1> const& lhs,
|
||||
sprout::square_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator<(sprout::square_iterator<Value1> const& lhs, sprout::square_iterator<Value2> const& rhs) {
|
||||
return lhs.index() < rhs.index();
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator>(
|
||||
sprout::square_iterator<Value1> const& lhs,
|
||||
sprout::square_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator>(sprout::square_iterator<Value1> const& lhs, sprout::square_iterator<Value2> const& rhs) {
|
||||
return rhs < lhs;
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator<=(
|
||||
sprout::square_iterator<Value1> const& lhs,
|
||||
sprout::square_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator<=(sprout::square_iterator<Value1> const& lhs, sprout::square_iterator<Value2> const& rhs) {
|
||||
return !(rhs < lhs);
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR bool operator>=(
|
||||
sprout::square_iterator<Value1> const& lhs,
|
||||
sprout::square_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator>=(sprout::square_iterator<Value1> const& lhs, sprout::square_iterator<Value2> const& rhs) {
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
template<typename Value1, typename Value2>
|
||||
inline SPROUT_CONSTEXPR typename sprout::square_iterator<Value1>::difference_type operator-(
|
||||
sprout::square_iterator<Value1> const& lhs,
|
||||
sprout::square_iterator<Value2> const& rhs
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR typename sprout::square_iterator<Value1>::difference_type
|
||||
operator-(sprout::square_iterator<Value1> const& lhs, sprout::square_iterator<Value2> const& rhs) {
|
||||
return lhs.index() - rhs.index();
|
||||
}
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::square_iterator<Value> operator+(
|
||||
typename sprout::square_iterator<Value>::difference_type n,
|
||||
sprout::square_iterator<Value> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::square_iterator<Value>
|
||||
operator+(typename sprout::square_iterator<Value>::difference_type n, sprout::square_iterator<Value> const& it) {
|
||||
return it + n;
|
||||
}
|
||||
|
||||
|
@ -224,7 +200,10 @@ namespace sprout {
|
|||
// swap
|
||||
//
|
||||
template<typename Value>
|
||||
inline void swap(sprout::square_iterator<Value>& lhs, sprout::square_iterator<Value>& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) {
|
||||
inline void
|
||||
swap(sprout::square_iterator<Value>& lhs, sprout::square_iterator<Value>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
|
@ -233,11 +212,7 @@ namespace sprout {
|
|||
//
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<sprout::square_iterator<Value> >::difference_type
|
||||
iterator_distance(
|
||||
sprout::square_iterator<Value> first,
|
||||
sprout::square_iterator<Value> last
|
||||
)
|
||||
{
|
||||
iterator_distance(sprout::square_iterator<Value> first, sprout::square_iterator<Value> last) {
|
||||
return last - first;
|
||||
}
|
||||
|
||||
|
@ -245,18 +220,13 @@ namespace sprout {
|
|||
// iterator_next
|
||||
//
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::square_iterator<Value> iterator_next(
|
||||
sprout::square_iterator<Value> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::square_iterator<Value>
|
||||
iterator_next(sprout::square_iterator<Value> const& it) {
|
||||
return it.next();
|
||||
}
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::square_iterator<Value> iterator_next(
|
||||
sprout::square_iterator<Value> const& it,
|
||||
typename sprout::square_iterator<Value>::difference_type n
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::square_iterator<Value>
|
||||
iterator_next(sprout::square_iterator<Value> const& it, typename sprout::square_iterator<Value>::difference_type n) {
|
||||
return it + n;
|
||||
}
|
||||
|
||||
|
@ -264,18 +234,13 @@ namespace sprout {
|
|||
// iterator_prev
|
||||
//
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::square_iterator<Value> iterator_prev(
|
||||
sprout::square_iterator<Value> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::square_iterator<Value>
|
||||
iterator_prev(sprout::square_iterator<Value> const& it) {
|
||||
return it.prev();
|
||||
}
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::square_iterator<Value> iterator_prev(
|
||||
sprout::square_iterator<Value> const& it,
|
||||
typename sprout::square_iterator<Value>::difference_type n
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::square_iterator<Value>
|
||||
iterator_prev(sprout::square_iterator<Value> const& it, typename sprout::square_iterator<Value>::difference_type n) {
|
||||
return it - n;
|
||||
}
|
||||
} // namespace sprout
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <sprout/iterator/next.hpp>
|
||||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -146,11 +147,16 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR transform_iterator prev() const {
|
||||
return transform_iterator(sprout::prev(current), sprout::prev(current2), func);
|
||||
}
|
||||
void swap(transform_iterator& other) {
|
||||
using std::swap;
|
||||
swap(current, other.current);
|
||||
swap(current2, other.current2);
|
||||
swap(func, other.func);
|
||||
void swap(transform_iterator& other)
|
||||
SPROUT_NOEXCEPT_EXPR(
|
||||
SPROUT_NOEXCEPT_EXPR(sprout::swap(current, other.current))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(current2, other.current2))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(func, other.func))
|
||||
)
|
||||
{
|
||||
sprout::swap(current, other.current);
|
||||
sprout::swap(current2, other.current2);
|
||||
sprout::swap(func, other.func);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -266,10 +272,14 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR transform_iterator prev() const {
|
||||
return transform_iterator(sprout::prev(current), func);
|
||||
}
|
||||
void swap(transform_iterator& other) {
|
||||
using std::swap;
|
||||
swap(current, other.current);
|
||||
swap(func, other.func);
|
||||
void swap(transform_iterator& other)
|
||||
SPROUT_NOEXCEPT_EXPR(
|
||||
SPROUT_NOEXCEPT_EXPR(sprout::swap(current, other.current))
|
||||
&& SPROUT_NOEXCEPT_EXPR(sprout::swap(func, other.func))
|
||||
)
|
||||
{
|
||||
sprout::swap(current, other.current);
|
||||
sprout::swap(func, other.func);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -377,11 +387,12 @@ namespace sprout {
|
|||
// swap
|
||||
//
|
||||
template<typename UnaryOrBinaryFunction, typename LIterator, typename RIterator>
|
||||
void swap(
|
||||
inline void
|
||||
swap(
|
||||
sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator>& lhs,
|
||||
sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator>& rhs
|
||||
)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
@ -403,14 +414,13 @@ namespace sprout {
|
|||
// iterator_next
|
||||
//
|
||||
template<typename UnaryOrBinaryFunction, typename LIterator, typename RIterator>
|
||||
inline SPROUT_CONSTEXPR sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator> iterator_next(
|
||||
sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator>
|
||||
iterator_next(sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator> const& it) {
|
||||
return it.next();
|
||||
}
|
||||
template<typename UnaryOrBinaryFunction, typename LIterator, typename RIterator>
|
||||
inline SPROUT_CONSTEXPR sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator> iterator_next(
|
||||
inline SPROUT_CONSTEXPR sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator>
|
||||
iterator_next(
|
||||
sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator> const& it,
|
||||
typename sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator>::difference_type n
|
||||
)
|
||||
|
@ -422,14 +432,13 @@ namespace sprout {
|
|||
// iterator_prev
|
||||
//
|
||||
template<typename UnaryOrBinaryFunction, typename LIterator, typename RIterator>
|
||||
inline SPROUT_CONSTEXPR sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator> iterator_prev(
|
||||
sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator>
|
||||
iterator_prev(sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator> const& it) {
|
||||
return it.prev();
|
||||
}
|
||||
template<typename UnaryOrBinaryFunction, typename LIterator, typename RIterator>
|
||||
inline SPROUT_CONSTEXPR sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator> iterator_prev(
|
||||
inline SPROUT_CONSTEXPR sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator>
|
||||
iterator_prev(
|
||||
sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator> const& it,
|
||||
typename sprout::transform_iterator<UnaryOrBinaryFunction, LIterator, RIterator>::difference_type n
|
||||
)
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/numeric/dft/fixed/triangle.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -136,12 +137,11 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR triangle_iterator prev() const {
|
||||
return triangle_iterator(*this, index_ - 1);
|
||||
}
|
||||
void swap(triangle_iterator& other) {
|
||||
using std::swap;
|
||||
swap(index_, other.index_);
|
||||
swap(frequency_, other.frequency_);
|
||||
swap(amplitude_, other.amplitude_);
|
||||
swap(phase_, other.phase_);
|
||||
void swap(triangle_iterator& other) SPROUT_NOEXCEPT {
|
||||
sprout::swap(index_, other.index_);
|
||||
sprout::swap(frequency_, other.frequency_);
|
||||
sprout::swap(amplitude_, other.amplitude_);
|
||||
sprout::swap(phase_, other.phase_);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -214,7 +214,10 @@ namespace sprout {
|
|||
// swap
|
||||
//
|
||||
template<typename Value>
|
||||
inline void swap(sprout::triangle_iterator<Value>& lhs, sprout::triangle_iterator<Value>& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) {
|
||||
inline void
|
||||
swap(sprout::triangle_iterator<Value>& lhs, sprout::triangle_iterator<Value>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
|
@ -223,11 +226,7 @@ namespace sprout {
|
|||
//
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<sprout::triangle_iterator<Value> >::difference_type
|
||||
iterator_distance(
|
||||
sprout::triangle_iterator<Value> first,
|
||||
sprout::triangle_iterator<Value> last
|
||||
)
|
||||
{
|
||||
iterator_distance(sprout::triangle_iterator<Value> first, sprout::triangle_iterator<Value> last) {
|
||||
return last - first;
|
||||
}
|
||||
|
||||
|
@ -235,18 +234,13 @@ namespace sprout {
|
|||
// iterator_next
|
||||
//
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::triangle_iterator<Value> iterator_next(
|
||||
sprout::triangle_iterator<Value> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::triangle_iterator<Value>
|
||||
iterator_next(sprout::triangle_iterator<Value> const& it) {
|
||||
return it.next();
|
||||
}
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::triangle_iterator<Value> iterator_next(
|
||||
sprout::triangle_iterator<Value> const& it,
|
||||
typename sprout::triangle_iterator<Value>::difference_type n
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::triangle_iterator<Value>
|
||||
iterator_next(sprout::triangle_iterator<Value> const& it, typename sprout::triangle_iterator<Value>::difference_type n) {
|
||||
return it + n;
|
||||
}
|
||||
|
||||
|
@ -254,18 +248,13 @@ namespace sprout {
|
|||
// iterator_prev
|
||||
//
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::triangle_iterator<Value> iterator_prev(
|
||||
sprout::triangle_iterator<Value> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::triangle_iterator<Value>
|
||||
iterator_prev(sprout::triangle_iterator<Value> const& it) {
|
||||
return it.prev();
|
||||
}
|
||||
template<typename Value>
|
||||
inline SPROUT_CONSTEXPR sprout::triangle_iterator<Value> iterator_prev(
|
||||
sprout::triangle_iterator<Value> const& it,
|
||||
typename sprout::triangle_iterator<Value>::difference_type n
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::triangle_iterator<Value>
|
||||
iterator_prev(sprout::triangle_iterator<Value> const& it, typename sprout::triangle_iterator<Value>::difference_type n) {
|
||||
return it - n;
|
||||
}
|
||||
} // namespace sprout
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <sprout/iterator/prev.hpp>
|
||||
#include <sprout/iterator/distance.hpp>
|
||||
#include <sprout/utility/value_holder.hpp>
|
||||
#include <sprout/utility/swap.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -74,10 +75,11 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR value_iterator prev() const {
|
||||
return value_iterator(holder_, count_ != 0 ? count_ + 1 : count_);
|
||||
}
|
||||
void swap(value_iterator& other) {
|
||||
using std::swap;
|
||||
swap(holder_, other.holder_);
|
||||
swap(count_, other.count_);
|
||||
void swap(value_iterator& other)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(holder_, other.holder_)))
|
||||
{
|
||||
sprout::swap(holder_, other.holder_);
|
||||
sprout::swap(count_, other.count_);
|
||||
}
|
||||
friend SPROUT_CONSTEXPR bool operator==(value_iterator const& lhs, value_iterator const& rhs) {
|
||||
return lhs.count_ == rhs.count_ && (lhs.count_ == 0 || lhs.holder_.get() == rhs.holder_.get());
|
||||
|
@ -160,7 +162,10 @@ namespace sprout {
|
|||
// swap
|
||||
//
|
||||
template<typename T>
|
||||
inline void swap(sprout::value_iterator<T>& lhs, sprout::value_iterator<T>& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) {
|
||||
inline void
|
||||
swap(sprout::value_iterator<T>& lhs, sprout::value_iterator<T>& rhs)
|
||||
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
|
@ -177,18 +182,13 @@ namespace sprout {
|
|||
// iterator_next
|
||||
//
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR sprout::value_iterator<T> iterator_next(
|
||||
sprout::value_iterator<T> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::value_iterator<T>
|
||||
iterator_next(sprout::value_iterator<T> const& it) {
|
||||
return it.next();
|
||||
}
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR sprout::value_iterator<T> iterator_next(
|
||||
sprout::value_iterator<T> const& it,
|
||||
typename sprout::value_iterator<T>::difference_type n
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::value_iterator<T>
|
||||
iterator_next(sprout::value_iterator<T> const& it, typename sprout::value_iterator<T>::difference_type n) {
|
||||
return it + n;
|
||||
}
|
||||
|
||||
|
@ -196,18 +196,13 @@ namespace sprout {
|
|||
// iterator_prev
|
||||
//
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR sprout::value_iterator<T> iterator_prev(
|
||||
sprout::value_iterator<T> const& it
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::value_iterator<T>
|
||||
iterator_prev(sprout::value_iterator<T> const& it) {
|
||||
return it.prev();
|
||||
}
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR sprout::value_iterator<T> iterator_prev(
|
||||
sprout::value_iterator<T> const& it,
|
||||
typename sprout::value_iterator<T>::difference_type n
|
||||
)
|
||||
{
|
||||
inline SPROUT_CONSTEXPR sprout::value_iterator<T>
|
||||
iterator_prev(sprout::value_iterator<T> const& it, typename sprout::value_iterator<T>::difference_type n) {
|
||||
return it - n;
|
||||
}
|
||||
} // namespace sprout
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue