75 #ifndef SLIP_BLOCK_HPP
76 #define SLIP_BLOCK_HPP
84 #include <boost/serialization/access.hpp>
85 #include <boost/serialization/split_member.hpp>
86 #include <boost/serialization/string.hpp>
87 #include <boost/serialization/complex.hpp>
88 #include <boost/serialization/version.hpp>
93 template <
class T, std::
size_t N>
96 template <
typename T, std::
size_t N>
100 template <
typename T, std::
size_t N>
104 template <
typename T, std::
size_t N>
108 template <
typename T, std::
size_t N>
109 bool operator<(const block<T,N>& x,
112 template <
typename T, std::
size_t N>
116 template <
typename T, std::
size_t N>
117 bool operator<=(const block<T,N>& x,
120 template <
typename T, std::
size_t N>
143 template <
class T, std::
size_t N>
172 static const std::size_t
SIZE = N;
173 static const std::size_t
DIM = 1;
284 assert(range.
start() >= 0);
285 assert(range.
stop() >= 0);
286 assert(range.
start() < int(this->
size()));
287 assert(range.
stop() < int(this->
size()));
312 assert(range.
start() >= 0);
313 assert(range.
stop() >= 0);
314 assert(range.
start() < int(this->
size()));
315 assert(range.
stop() < int(this->
size()));
472 friend std::ostream& operator<< <>(std::ostream & out,
514 std::fill_n(this->
begin(),N,value);
535 template<
typename InputIterator>
553 friend bool operator== <>(
const block<T,N>& x,
562 friend bool operator!= <>(
const block<T,N>& x,
589 friend bool operator<= <>(
const block<T,N>& x,
598 friend bool operator>= <>(
const block<T,N>& x,
697 friend class boost::serialization::access;
698 template<
class Archive>
699 void save(Archive & ar,
const unsigned int version)
const
703 template<
class Archive>
704 void load(Archive & ar,
const unsigned int version)
708 BOOST_SERIALIZATION_SPLIT_MEMBER()
717 template <
typename T, std::
size_t N>
722 if(N > std::size_t(1))
723 for(std::size_t n = 0; n != N - 1; ++n)
734 template <
typename T, std::
size_t N>
743 template <
typename T, std::
size_t N>
754 template <
typename T, std::
size_t N>
756 bool operator<(const block<T,N>& x,
759 return std::lexicographical_compare(x.begin(), x.end(),
764 template <
typename T, std::
size_t N>
773 template <
typename T, std::
size_t N>
775 bool operator<=(const block<T,N>& x,
782 template <
typename T, std::
size_t N>
792 #endif //SLIP_BLOCK_HPP
iterator begin()
Returns a read/write iterator that points to the first element in the block. Iteration is done in ord...
block< T, N > & operator=(const T &val)
Assigns all the element of the block by val.
bool operator!=(const Array< T > &x, const Array< T > &y)
std::size_t iterations() const
Rerturns the number of iterations of the range.
const_iterator_range begin(const slip::Range< int > &range) const
Returns a read-only (constant) iterator_range that points the first element within the Range...
const_iterator_range end(const slip::Range< int > &range) const
Returns a read-only (constant) iterator_range that points one past the last element in the block...
void swap(block &x)
Swaps data with another block.
const_reference operator()(const size_type n) const
Subscript access to the data contained in the block.
std::reverse_iterator< const_iterator_range > const_reverse_iterator_range
const_reverse_iterator rend() const
Returns a read-only (constant) reverse iterator that points to one before the first element in the bl...
size_type max_size() const
Returns the largest possible block.
slip::stride_iterator< const_pointer > const_iterator_range
const value_type * const_pointer
static const std::size_t DIM
slip::stride_iterator< pointer > iterator_range
T data[N]
Data array storage of the block.
iterator default_iterator
const_iterator begin() const
Returns a read-only (constant) iterator that points to the first element in the block. Iteration is done in ordinary element order.
block< T, N > & operator=(const block< T, N > &rhs)
Assigns all the element of the block by the block rhs.
bool operator>(const Array< T > &x, const Array< T > &y)
const_iterator const_default_iterator
reference operator[](const size_type n)
Subscript access to the data contained in the block.
iterator_range begin(const slip::Range< int > &range)
Returns a read/write iterator_range that points the first element within the Range. Iteration is done in ordinary element order according to the Range.
reverse_iterator_range rbegin(const slip::Range< int > &range)
Returns a read/write reverse_iterator_range that points the end element within the Range...
const_reference operator[](const size_type n) const
Subscript access to the data contained in the block.
void fill(const T *value)
Fills the container range [begin(),begin()+N) with a copy of the value array.
reverse_iterator rend()
Returns a read/write reverse iterator that points to one before the first element in the block...
const_reverse_iterator rbegin() const
Returns a read-only (constant) reverse iterator that points to the last element in the block...
void copy(_II first, _II last, _OI output_first)
Copy algorithm optimized for slip iterators.
reverse_iterator_range rend(const slip::Range< int > &range)
Returns a read/write reverse_iterator_range that points one previous the first element in the Range...
bool is_valid() const
Returns true if the range is valid :
SubType start() const
Accessor of the start subscript of the Range.
iterator end()
Returns a read/write iterator that points one past the last element in the block. Iteration is done i...
reverse_iterator rbegin()
Returns a read/write reverse iterator that points to the last element in the block. Iteration is done in reverse element order.
const_reverse_iterator_range rbegin(const slip::Range< int > &range) const
Returns a read-only (constant) reverse_iterator_range that points the end element within the Range...
std::ostream & operator<<(std::ostream &out, const Array< T > &a)
ptrdiff_t difference_type
std::reverse_iterator< iterator > reverse_iterator
void fill(InputIterator first, InputIterator last)
Fills the container range [begin(),begin()+N) with a copy of the range [first,last) ...
void fill(const T &value)
Fills the container range [begin(),begin()+N) with copies of value.
const_pointer const_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
size_type size() const
Returns the number of elements in the block.
int stride() const
Accessor of the stride of the Range.
Provides a class to iterate a 1d range according to a step.
bool operator==(const Array< T > &x, const Array< T > &y)
const_reverse_iterator_range rend(const slip::Range< int > &range) const
Returns a read-only (constant) reverse_iterator_range that points one previous the first element in t...
const_iterator end() const
Returns a read-only (constant) iterator that points one past the last element in the block...
bool empty() const
Returns true if the block is empty. (Thus size == 0)
iterator_range end(const slip::Range< int > &range)
Returns a read/write iterator_range that points one past the last element in the block. Iteration is done in ordinary element order according to the Range.
Provides a class to manipulate Ranges.
const value_type & const_reference
SubType stop() const
Accessor of the stop subscript of the Range.
bool operator>=(const Array< T > &x, const Array< T > &y)
static const std::size_t SIZE
reference operator()(const size_type n)
Subscript access to the data contained in the block.
std::reverse_iterator< iterator_range > reverse_iterator_range
This is a linear (one-dimensional) static container. This container statisfies the RandomAccessContai...