1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-07-02 14:04:09 +00:00

add doc: array members

This commit is contained in:
Bolero-MURAKAMI 2013-08-25 23:14:03 +09:00
parent 227a35c29c
commit 3a5283e165
91 changed files with 6507 additions and 572 deletions

View file

@ -10,17 +10,17 @@ Interface
template<typename ForwardIterator1, typename ForwardIterator2>
inline SPROUT_CONSTEXPR ForwardIterator1
find_end(
ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2
);
ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2
);
template<typename ForwardIterator1, typename ForwardIterator2, typename BinaryPredicate>
inline SPROUT_CONSTEXPR ForwardIterator1
find_end(
ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2,
BinaryPredicate pred
);
ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2,
BinaryPredicate pred
);
Effects
========================================

View file

@ -10,17 +10,17 @@ Interface
template<typename InputIterator1, typename ForwardIterator2>
inline SPROUT_CONSTEXPR InputIterator1
find_first_of(
InputIterator1 first1, InputIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2
);
InputIterator1 first1, InputIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2
);
template<typename InputIterator1, typename ForwardIterator2, typename BinaryPredicate>
inline SPROUT_CONSTEXPR InputIterator1
find_first_of(
InputIterator1 first1, InputIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2,
BinaryPredicate pred
);
InputIterator1 first1, InputIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2,
BinaryPredicate pred
);
Effects
========================================

View file

@ -54,78 +54,106 @@ Sprout.Algorithm
Non-modifying sequence operations
*******************************************************************************
* :doc:`all_of <./all_of>`
* :doc:`all_of_equal <./all_of_equal>`
* :doc:`any_of <./any_of>`
* :doc:`any_of_equal <./any_of_equal>`
* :doc:`none_of <./none_of>`
* :doc:`none_of_equal <./none_of_equal>`
* :doc:`one_of <./one_of>`
* :doc:`one_of_equal <./one_of_equal>`
* :doc:`find <./find>`
* :doc:`find_if <./find_if>`
* :doc:`find_if_not <./find_if_not>`
* :doc:`find_end <./find_end>`
* :doc:`find_first_of <./find_first_of>`
* :doc:`adjacent_find <./adjacent_find>`
* :doc:`count <./count>`
* :doc:`count_if <./count_if>`
* :doc:`mismatch <./mismatch>`
* :doc:`equal <./equal>`
* :doc:`is_permutation <./is_permutation>`
* :doc:`search <./search>`
* :doc:`search_n <./search_n>`
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`all_of <./all_of>`
:doc:`all_of_equal <./all_of_equal>`
:doc:`any_of <./any_of>`
:doc:`any_of_equal <./any_of_equal>`
:doc:`none_of <./none_of>`
:doc:`none_of_equal <./none_of_equal>`
:doc:`one_of <./one_of>`
:doc:`one_of_equal <./one_of_equal>`
:doc:`find <./find>`
:doc:`find_if <./find_if>`
:doc:`find_if_not <./find_if_not>`
:doc:`find_end <./find_end>`
:doc:`find_first_of <./find_first_of>`
:doc:`adjacent_find <./adjacent_find>`
:doc:`count <./count>`
:doc:`count_if <./count_if>`
:doc:`mismatch <./mismatch>`
:doc:`equal <./equal>`
:doc:`is_permutation <./is_permutation>`
:doc:`search <./search>`
:doc:`search_n <./search_n>`
======================================== ===============================================================================
.. _sprout-algorithm-non_modifying-sorting:
Sorting
========================================
* :doc:`is_sorted <./is_sorted>`
* :doc:`is_sorted_until <./is_sorted_until>`
* :doc:`is_increasing <./is_increasing>`
* :doc:`is_decreasing <./is_decreasing>`
* :doc:`is_strictly_increasing <./is_strictly_increasing>`
* :doc:`is_strictly_decreasing <./is_strictly_decreasing>`
================================================================================ ===============================================================================
function
================================================================================ ===============================================================================
:doc:`is_sorted <./is_sorted>`
:doc:`is_sorted_until <./is_sorted_until>`
:doc:`is_increasing <./is_increasing>`
:doc:`is_decreasing <./is_decreasing>`
:doc:`is_strictly_increasing <./is_strictly_increasing>`
:doc:`is_strictly_decreasing <./is_strictly_decreasing>`
================================================================================ ===============================================================================
.. _sprout-algorithm-non_modifying-binary:
Binary search
========================================
* :doc:`lower_bound <./lower_bound>`
* :doc:`upper_bound <./upper_bound>`
* :doc:`equal_range <./equal_range>`
* :doc:`binary_search <./binary_search>`
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`lower_bound <./lower_bound>`
:doc:`upper_bound <./upper_bound>`
:doc:`equal_range <./equal_range>`
:doc:`binary_search <./binary_search>`
======================================== ===============================================================================
.. _sprout-algorithm-non_modifying-heap:
Heap operations
========================================
* :doc:`is_heap <./is_heap>`
* :doc:`is_heap_until <./is_heap_until>`
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`is_heap <./is_heap>`
:doc:`is_heap_until <./is_heap_until>`
======================================== ===============================================================================
.. _sprout-algorithm-non_modifying-minmax:
Minimum and maximum
========================================
* :doc:`min <./min>`
* :doc:`max <./max>`
* :doc:`minmax <./minmax>`
* :doc:`min_element <./min_element>`
* :doc:`max_element <./max_element>`
* :doc:`minmax_element <./minmax_element>`
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`min <./min>`
:doc:`max <./max>`
:doc:`minmax <./minmax>`
:doc:`min_element <./min_element>`
:doc:`max_element <./max_element>`
:doc:`minmax_element <./minmax_element>`
======================================== ===============================================================================
.. _sprout-algorithm-non_modifying-lexicographical:
Lexicographical comparison
========================================
* :doc:`lexicographical_compare <./lexicographical_compare>`
* :doc:`tristate_lexicographical_compare <./tristate_lexicographical_compare>`
================================================================================ ===============================================================================
function
================================================================================ ===============================================================================
:doc:`lexicographical_compare <./lexicographical_compare>`
:doc:`tristate_lexicographical_compare <./tristate_lexicographical_compare>`
================================================================================ ===============================================================================
.. _sprout-algorithm-non_modifying-clamp:
Clamp algorithm
========================================
* :doc:`clamp <./clamp>`
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`clamp <./clamp>`
======================================== ===============================================================================
Header
========================================

View file

@ -10,17 +10,17 @@ Interface
template<typename InputIterator1, typename InputIterator2>
inline SPROUT_CONSTEXPR bool
lexicographical_compare(
InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2
);
InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2
);
template<typename InputIterator1, typename InputIterator2, typename Compare>
inline SPROUT_CONSTEXPR bool
lexicographical_compare(
InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2,
Compare comp
);
InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2,
Compare comp
);
Returns
========================================
@ -37,8 +37,8 @@ Remarks
.. sourcecode:: c++
for (; first1 != last1 && first2 != last2; ++first1, ++first2) {
if (*first1 < *first2) return true;
if (*first2 < *first1) return false;
if (*first1 < *first2) return true;
if (*first2 < *first1) return false;
}
return first1 == last1 && first2 != last2;

View file

@ -10,17 +10,17 @@ Interface
template<typename ForwardIterator1, typename ForwardIterator2>
inline SPROUT_CONSTEXPR ForwardIterator1
search(
ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2
);
ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2
);
template<typename ForwardIterator1, typename ForwardIterator2, typename BinaryPredicate>
inline SPROUT_CONSTEXPR ForwardIterator1
search(
ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2,
BinaryPredicate pred
);
ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2,
BinaryPredicate pred
);
Effects
========================================

View file

@ -10,17 +10,17 @@ Interface
template<typename InputIterator1, typename InputIterator2>
inline SPROUT_CONSTEXPR int
tristate_lexicographical_compare(
InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2
);
InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2
);
template<typename InputIterator1, typename InputIterator2, typename Compare>
inline SPROUT_CONSTEXPR int
tristate_lexicographical_compare(
InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2,
Compare comp
);
InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2,
Compare comp
);
Returns
========================================

View file

@ -0,0 +1,55 @@
.. _sprout-array-array-assign:
###############################################################################
assign
###############################################################################
Interface
========================================
.. sourcecode:: c++
void assign(const_reference value);
SPROUT_CONSTEXPR array assign(const_reference value) const;
Effects
========================================
| ``std::fill_n(begin(), N, value)``, or without effects in the case of const version.
Returns
========================================
| void, or array filled with value in the case of const version.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
x.assign(0);
SPROUT_ASSERT_MSG(x[0] = 0, "filled with 0.");
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
SPROUT_STATIC_CONSTEXPR auto y = x.assign(0);
static_assert(y[0] = 0, "filled with 0.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,44 @@
.. _sprout-array-array-at:
###############################################################################
at
###############################################################################
Interface
========================================
.. sourcecode:: c++
reference at(size_type n);
SPROUT_CONSTEXPR const_reference at(size_type n) const;
Returns
========================================
| The element at the specified position in the array.
Throws
========================================
| It throws std::out_of_range if n is out of bounds.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(input.at(5) == 6, "an element at position 5 is 6.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,39 @@
.. _sprout-array-array-back:
###############################################################################
back
###############################################################################
Interface
========================================
.. sourcecode:: c++
reference back();
SPROUT_CONSTEXPR const_reference back() const;
Returns
========================================
| A reference to the last element in the array.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(input.back() == 10, "a last element is 10.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,39 @@
.. _sprout-array-array-begin:
###############################################################################
begin
###############################################################################
Interface
========================================
.. sourcecode:: c++
iterator begin() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator begin() const SPROUT_NOEXCEPT;
Returns
========================================
| iterator for the first element.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(*input.begin() == 1, "input first element is 1.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,39 @@
.. _sprout-array-array-c_array:
###############################################################################
back
###############################################################################
Interface
========================================
.. sourcecode:: c++
pointer c_array() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_pointer c_array() const SPROUT_NOEXCEPT;
Returns
========================================
| Pointer to the data contained by the array.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(input.c_array()[0] == 1, "a first element is 1.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,37 @@
.. _sprout-array-array-cbegin:
###############################################################################
cbegin
###############################################################################
Interface
========================================
.. sourcecode:: c++
SPROUT_CONSTEXPR const_iterator cbegin() const SPROUT_NOEXCEPT;
Returns
========================================
| iterator for the first element always const.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(*input.cbegin() == 1, "input first element is 1.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,37 @@
.. _sprout-array-array-cbegin:
###############################################################################
cbegin
###############################################################################
Interface
========================================
.. sourcecode:: c++
SPROUT_CONSTEXPR const_iterator cbegin() const SPROUT_NOEXCEPT;
Returns
========================================
| iterator for position after the last element always const.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(*(input.cbegin() - 1) == 1, "input last element is 10.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,37 @@
.. _sprout-array-array-crbegin:
###############################################################################
crbegin
###############################################################################
Interface
========================================
.. sourcecode:: c++
SPROUT_CONSTEXPR const_reverse_iterator crbegin() const SPROUT_NOEXCEPT;
Returns
========================================
| reverse iterator for the first element of reverse iteration always const.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(*input.crbegin() == 10, "input first element of reverse iteration is 10.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,37 @@
.. _sprout-array-array-crend:
###############################################################################
crend
###############################################################################
Interface
========================================
.. sourcecode:: c++
SPROUT_CONSTEXPR const_reverse_iterator crend() const SPROUT_NOEXCEPT;
Returns
========================================
| reverse iterator for position after the last element in reverse iteration always const.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(*(input.crend() - 1) == 1, "input last element of reverse iteration is 1.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,39 @@
.. _sprout-array-array-data:
###############################################################################
back
###############################################################################
Interface
========================================
.. sourcecode:: c++
pointer data() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_pointer data() const SPROUT_NOEXCEPT;
Returns
========================================
| Pointer to the data contained by the array.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(input.data()[0] == 1, "a first element is 1.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,37 @@
.. _sprout-array-array-empty:
###############################################################################
empty
###############################################################################
Interface
========================================
.. sourcecode:: c++
SPROUT_CONSTEXPR bool empty() const SPROUT_NOEXCEPT;
Returns
========================================
| true if the array size is 0, false otherwise.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 0>{{}};
static_assert(input.empty() == 10, "input is empty.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,39 @@
.. _sprout-array-array-end:
###############################################################################
end
###############################################################################
Interface
========================================
.. sourcecode:: c++
iterator end() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator end() const SPROUT_NOEXCEPT;
Returns
========================================
| iterator for position after the last element.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(*(input.end() - 1) == 1, "input last element is 10.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,55 @@
.. _sprout-array-array-fill:
###############################################################################
fill
###############################################################################
Interface
========================================
.. sourcecode:: c++
void fill(const_reference value);
SPROUT_CONSTEXPR array fill(const_reference value) const;
Effects
========================================
| ``std::fill_n(begin(), N, value)``, or without effects in the case of const version.
Returns
========================================
| void, or array filled with value in the case of const version.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
x.fill(0);
SPROUT_ASSERT_MSG(x[0] = 0, "filled with 0.");
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
SPROUT_STATIC_CONSTEXPR auto y = x.fill(0);
static_assert(y[0] = 0, "filled with 0.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,39 @@
.. _sprout-array-array-front:
###############################################################################
front
###############################################################################
Interface
========================================
.. sourcecode:: c++
reference front();
SPROUT_CONSTEXPR const_reference front() const;
Returns
========================================
| A reference to the first element in the array.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(input.front() == 1, "a first element is 1.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -6,128 +6,189 @@ Class template array
.. toctree::
:hidden:
initializer-
operator-assign
fill
assign
swap
begin
end
rbegin
rend
cbegin
cend
crbegin
crend
size
max_size
empty
at
operator-subscript
front
back
data
c_array
Interface
========================================
.. sourcecode:: c++
template <typename T, std::size_t N>
class array {
// types:
typedef T& reference;
typedef T const& const_reference;
typedef /*implementation-defined*/ iterator;
typedef /*implementation-defined*/ const_iterator;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef T value_type;
typedef T* pointer;
typedef T const* const_pointer;
typedef sprout::reverse_iterator<iterator> reverse_iterator;
typedef sprout::reverse_iterator<const_iterator> const_reverse_iterator;
// types:
typedef T& reference;
typedef T const& const_reference;
typedef /*implementation-defined*/ iterator;
typedef /*implementation-defined*/ const_iterator;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef T value_type;
typedef T* pointer;
typedef T const* const_pointer;
typedef sprout::reverse_iterator<iterator> reverse_iterator;
typedef sprout::reverse_iterator<const_iterator> const_reverse_iterator;
// constants:
SPROUT_STATIC_CONSTEXPR size_type static_size = N;
// constants:
SPROUT_STATIC_CONSTEXPR size_type static_size = N;
T elems[N ? N : 1]; // exposition only
T elems[N ? N : 1]; // exposition only
// construct/copy/destroy:
template<typename T2>
array& operator=(array<T2, N> const& rhs);
template<typename T2>
array& operator=(array<T2, N>&& rhs);
// construct/copy/destroy:
template<typename T2>
array& operator=(array<T2, N> const& rhs);
template<typename T2>
array& operator=(array<T2, N>&& rhs);
// modifiers:
void fill(const_reference u);
SPROUT_CONSTEXPR array fill(const_reference value) const;
void assign(const_reference value);
SPROUT_CONSTEXPR array assign(const_reference value) const;
void swap(array&) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::swap(std::declval<T&>(), std::declval<T&>())));
// modifiers:
void fill(const_reference value);
SPROUT_CONSTEXPR array fill(const_reference value) const;
void assign(const_reference value);
SPROUT_CONSTEXPR array assign(const_reference value) const;
void swap(array&) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::swap(std::declval<T&>(), std::declval<T&>())));
// iterators:
iterator begin() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator begin() const SPROUT_NOEXCEPT;
iterator end() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator end() const SPROUT_NOEXCEPT;
reverse_iterator rbegin() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator rbegin() const SPROUT_NOEXCEPT;
reverse_iterator rend() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator rend() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator cbegin() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator cend() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator crbegin() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator crend() const SPROUT_NOEXCEPT;
// iterators:
iterator begin() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator begin() const SPROUT_NOEXCEPT;
iterator end() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator end() const SPROUT_NOEXCEPT;
reverse_iterator rbegin() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator rbegin() const SPROUT_NOEXCEPT;
reverse_iterator rend() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator rend() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator cbegin() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_iterator cend() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator crbegin() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator crend() const SPROUT_NOEXCEPT;
// capacity:
SPROUT_CONSTEXPR size_type size() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR size_type max_size() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR bool empty() const SPROUT_NOEXCEPT;
// capacity:
SPROUT_CONSTEXPR size_type size() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR size_type max_size() const SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR bool empty() const SPROUT_NOEXCEPT;
// element access:
reference operator[](size_type n);
SPROUT_CONSTEXPR const_reference operator[](size_type n) const;
reference at(size_type n);
SPROUT_CONSTEXPR const_reference at(size_type n) const;
reference front();
SPROUT_CONSTEXPR const_reference front() const;
reference back();
SPROUT_CONSTEXPR const_reference back() const;
pointer data() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_pointer data() const SPROUT_NOEXCEPT;
pointer c_array() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_pointer c_array() const SPROUT_NOEXCEPT;
// element access:
reference operator[](size_type n);
SPROUT_CONSTEXPR const_reference operator[](size_type n) const;
reference at(size_type n);
SPROUT_CONSTEXPR const_reference at(size_type n) const;
reference front();
SPROUT_CONSTEXPR const_reference front() const;
reference back();
SPROUT_CONSTEXPR const_reference back() const;
pointer data() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_pointer data() const SPROUT_NOEXCEPT;
pointer c_array() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_pointer c_array() const SPROUT_NOEXCEPT;
};
Description
========================================
Member types
----------------------------------------
======================================== =============================================================================== =======================================
type definition note
======================================== =============================================================================== =======================================
reference T&
const_reference T const&
iterator *implementation-defined*, convertible to const_iterator,
**ConstexprRandomAccessIterator** convertible to pointer
const_iterator *implementation-defined*, convertible to const_pointer
**ConstexprRandomAccessIterator**
size_type std::size_t
difference_type std::ptrdiff_t
value_type T
pointer T*
const_pointer T const*
reverse_iterator sprout::reverse_iterator<iterator>,
**ConstexprRandomAccessIterator**
const_reverse_iterator sprout::reverse_iterator<const_iterator>,
**ConstexprRandomAccessIterator**
======================================== =============================================================================== =======================================
Member functions
----------------------------------------
(initializer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* :doc:`(initializer) <./array/initializer->`
construct/copy/destroy
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* :doc:`operator= <./array/operator-assign>`
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`(initializer) <./initializer->`
======================================== ===============================================================================
modifiers
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* :doc:`fill <./array/fill>`
* :doc:`assign <./array/assign>`
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`fill <./fill>`
:doc:`assign <./assign>`
:doc:`swap <./swap>`
======================================== ===============================================================================
iterators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* :doc:`begin <./array/begin>`
* :doc:`end <./array/end>`
* :doc:`rbegin <./array/rbegin>`
* :doc:`rend <./array/rend>`
* :doc:`cbegin <./array/cbegin>`
* :doc:`cend <./array/cend>`
* :doc:`crbegin <./array/crbegin>`
* :doc:`crend <./array/crend>`
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`begin <./begin>`
:doc:`end <./end>`
:doc:`rbegin <./rbegin>`
:doc:`rend <./rend>`
:doc:`cbegin <./cbegin>`
:doc:`cend <./cend>`
:doc:`crbegin <./crbegin>`
:doc:`crend <./crend>`
======================================== ===============================================================================
capacity
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* :doc:`size <./array/size>`
* :doc:`max_size <./array/max_size>`
* :doc:`empty <./array/empty>`
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`size <./size>`
:doc:`max_size <./max_size>`
:doc:`empty <./empty>`
======================================== ===============================================================================
element access
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* :doc:`operator[] <./array/operator-subscript>`
* :doc:`at <./array/at>`
* :doc:`front <./array/front>`
* :doc:`back <./array/back>`
* :doc:`data <./array/data>`
* :doc:`c_array <./array/c_array>`
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`operator[] <./operator-subscript>`
:doc:`at <./at>`
:doc:`front <./front>`
:doc:`back <./back>`
:doc:`data <./data>`
:doc:`c_array <./c_array>`
======================================== ===============================================================================
Header
========================================

View file

@ -0,0 +1,36 @@
.. _sprout-array-array-initializer-:
###############################################################################
(initializer)
###############################################################################
Remarks
========================================
| An array is an aggregate that can be initialized with the syntax
.. sourcecode:: c++
array<T, N> a = { initializer-list };
| where initializer-list is a comma-separated list of up to N elements whose types are convertible to T.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,37 @@
.. _sprout-array-array-max_size:
###############################################################################
max_size
###############################################################################
Interface
========================================
.. sourcecode:: c++
SPROUT_CONSTEXPR size_type max_size() const SPROUT_NOEXCEPT;
Returns
========================================
| The number of elements contained in the array.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(input.max_size() == 10, "input max size is 10.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,41 @@
.. _sprout-array-array-operator-assign:
###############################################################################
operator=
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename T2>
array& operator=(array<T2, N> const& rhs);
template<typename T2>
array& operator=(array<T2, N>&& rhs);
Effects
========================================
| ``std::copy(rhs.begin(), rhs.end(), begin())``, ``std::move(rhs.begin(), rhs.end(), begin())``.
Returns
========================================
| ``*this``.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
x = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,44 @@
.. _sprout-array-array-operator-subscript:
###############################################################################
operator[]
###############################################################################
Interface
========================================
.. sourcecode:: c++
reference operator[](size_type n);
SPROUT_CONSTEXPR const_reference operator[](size_type n) const;
Returns
========================================
| The element at the specified position in the array.
Remarks
========================================
| It causes undefined behavior if n is out of bounds.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(input[5] == 6, "an element at position 5 is 6.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,39 @@
.. _sprout-array-array-rbegin:
###############################################################################
rbegin
###############################################################################
Interface
========================================
.. sourcecode:: c++
reverse_iterator rbegin() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator rbegin() const SPROUT_NOEXCEPT;
Returns
========================================
| reverse iterator for the first element of reverse iteration.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(*input.rbegin() == 10, "input first element of reverse iteration is 10.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,39 @@
.. _sprout-array-array-rend:
###############################################################################
rend
###############################################################################
Interface
========================================
.. sourcecode:: c++
reverse_iterator rend() SPROUT_NOEXCEPT;
SPROUT_CONSTEXPR const_reverse_iterator rend() const SPROUT_NOEXCEPT;
Returns
========================================
| reverse iterator for position after the last element in reverse iteration.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(*(input.rend() - 1) == 1, "input last element of reverse iteration is 1.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,37 @@
.. _sprout-array-array-size:
###############################################################################
size
###############################################################################
Interface
========================================
.. sourcecode:: c++
SPROUT_CONSTEXPR size_type size() const SPROUT_NOEXCEPT;
Returns
========================================
| The number of elements contained in the array.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(input.size() == 10, "input size is 10.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -0,0 +1,46 @@
.. _sprout-array-array-swap:
###############################################################################
swap
###############################################################################
Interface
========================================
.. sourcecode:: c++
void swap(array& y) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::swap(std::declval<T&>(), std::declval<T&>())));
Returns
========================================
| ``swap_ranges(begin(), end(), y.begin())``.
Throws
========================================
| Nothing unless one of the element-wise swap calls throws an exception.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
auto x = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
auto y = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
x.swap(y);
SPROUT_ASSERT_MSG(x[0] = 10 && y[0] == 1, "each element are swapped.");
Complexity
========================================
| Linear.
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -8,29 +8,24 @@ Sprout.Array
array/index
Interface
========================================
.. sourcecode:: c++
template <typename T, std::size_t N>
class array;
template<typename T, std::size_t N>
inline void swap(sprout::array<T, N>& lhs, sprout::array<T, N>& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)));
template<typename T, std::size_t N>
inline SPROUT_CONSTEXPR sprout::array<T, N> to_array(T const (& arr)[N]);
Classes
========================================
* :doc:`array <./array/index>`
======================================== ===============================================================================
class
======================================== ===============================================================================
:doc:`array <./array/index>`
======================================== ===============================================================================
Non-member functions
========================================
* :doc:`swap <./swap>`
* :doc:`to_array <./to_array>`
======================================== ===============================================================================
function
======================================== ===============================================================================
:doc:`swap <./swap>`
:doc:`to_array <./to_array>`
======================================== ===============================================================================
Header
========================================