mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-12 14:54:10 +00:00
fix directory structure
This commit is contained in:
parent
bd73a0c510
commit
bf12021ae6
241 changed files with 1777 additions and 2122 deletions
55
source/libs/array/array/assign.rst
Normal file
55
source/libs/array/array/assign.rst
Normal 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``
|
||||
|
44
source/libs/array/array/at.rst
Normal file
44
source/libs/array/array/at.rst
Normal 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``
|
||||
|
39
source/libs/array/array/back.rst
Normal file
39
source/libs/array/array/back.rst
Normal 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``
|
||||
|
39
source/libs/array/array/begin.rst
Normal file
39
source/libs/array/array/begin.rst
Normal 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``
|
||||
|
39
source/libs/array/array/c_array.rst
Normal file
39
source/libs/array/array/c_array.rst
Normal 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``
|
||||
|
37
source/libs/array/array/cbegin.rst
Normal file
37
source/libs/array/array/cbegin.rst
Normal 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``
|
||||
|
37
source/libs/array/array/cend.rst
Normal file
37
source/libs/array/array/cend.rst
Normal 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``
|
||||
|
37
source/libs/array/array/crbegin.rst
Normal file
37
source/libs/array/array/crbegin.rst
Normal 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``
|
||||
|
37
source/libs/array/array/crend.rst
Normal file
37
source/libs/array/array/crend.rst
Normal 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``
|
||||
|
39
source/libs/array/array/data.rst
Normal file
39
source/libs/array/array/data.rst
Normal 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``
|
||||
|
37
source/libs/array/array/empty.rst
Normal file
37
source/libs/array/array/empty.rst
Normal 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``
|
||||
|
39
source/libs/array/array/end.rst
Normal file
39
source/libs/array/array/end.rst
Normal 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``
|
||||
|
55
source/libs/array/array/fill.rst
Normal file
55
source/libs/array/array/fill.rst
Normal 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``
|
||||
|
39
source/libs/array/array/front.rst
Normal file
39
source/libs/array/array/front.rst
Normal 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``
|
||||
|
207
source/libs/array/array/index.rst
Normal file
207
source/libs/array/array/index.rst
Normal file
|
@ -0,0 +1,207 @@
|
|||
.. _sprout-array-array:
|
||||
###############################################################################
|
||||
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;
|
||||
|
||||
// constants:
|
||||
SPROUT_STATIC_CONSTEXPR size_type static_size = N;
|
||||
|
||||
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);
|
||||
|
||||
// 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;
|
||||
|
||||
// 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;
|
||||
};
|
||||
|
||||
Description
|
||||
========================================
|
||||
|
||||
Member types
|
||||
----------------------------------------
|
||||
|
||||
======================================== =============================================================================== =======================================
|
||||
type definition note
|
||||
======================================== =============================================================================== =======================================
|
||||
reference T&
|
||||
const_reference T const&
|
||||
iterator **ConstexprRandomAccessIterator** convertible to const_iterator,
|
||||
convertible to pointer
|
||||
const_iterator **ConstexprRandomAccessIterator** convertible to const_pointer
|
||||
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)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
======================================== ===============================================================================
|
||||
function
|
||||
======================================== ===============================================================================
|
||||
:doc:`(initializer) <./initializer->`
|
||||
======================================== ===============================================================================
|
||||
|
||||
construct/copy/destroy
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
======================================== ===============================================================================
|
||||
function
|
||||
======================================== ===============================================================================
|
||||
:doc:`operator= <./operator-assign>`
|
||||
======================================== ===============================================================================
|
||||
|
||||
modifiers
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
======================================== ===============================================================================
|
||||
function
|
||||
======================================== ===============================================================================
|
||||
:doc:`fill <./fill>`
|
||||
:doc:`assign <./assign>`
|
||||
:doc:`swap <./swap>`
|
||||
======================================== ===============================================================================
|
||||
|
||||
iterators
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
======================================== ===============================================================================
|
||||
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
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
======================================== ===============================================================================
|
||||
function
|
||||
======================================== ===============================================================================
|
||||
:doc:`size <./size>`
|
||||
:doc:`max_size <./max_size>`
|
||||
:doc:`empty <./empty>`
|
||||
======================================== ===============================================================================
|
||||
|
||||
element access
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
======================================== ===============================================================================
|
||||
function
|
||||
======================================== ===============================================================================
|
||||
:doc:`operator[] <./operator-subscript>`
|
||||
:doc:`at <./at>`
|
||||
:doc:`front <./front>`
|
||||
:doc:`back <./back>`
|
||||
:doc:`data <./data>`
|
||||
:doc:`c_array <./c_array>`
|
||||
======================================== ===============================================================================
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
``sprout/array/array.hpp``
|
||||
|
||||
Convenience header: ``sprout/array.hpp``
|
||||
|
36
source/libs/array/array/initializer-.rst
Normal file
36
source/libs/array/array/initializer-.rst
Normal 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``
|
||||
|
37
source/libs/array/array/max_size.rst
Normal file
37
source/libs/array/array/max_size.rst
Normal 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``
|
||||
|
41
source/libs/array/array/operator-assign.rst
Normal file
41
source/libs/array/array/operator-assign.rst
Normal 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``
|
||||
|
40
source/libs/array/array/operator-equal_to.rst
Normal file
40
source/libs/array/array/operator-equal_to.rst
Normal file
|
@ -0,0 +1,40 @@
|
|||
.. _sprout-array-array-operator-equal_to:
|
||||
###############################################################################
|
||||
operator==
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator==(sprout::array<T, N> const& lhs, sprout::array<T, N> const& rhs);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| true if the contents of the containers are equivalent, false otherwise.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. 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 = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
static_assert(x == y, "x is equal to y.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/array/comparison.hpp``
|
||||
| Convenience header: ``sprout/array.hpp``
|
||||
|
40
source/libs/array/array/operator-greater.rst
Normal file
40
source/libs/array/array/operator-greater.rst
Normal file
|
@ -0,0 +1,40 @@
|
|||
.. _sprout-array-array-operator-greater:
|
||||
###############################################################################
|
||||
operator>
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator>(sprout::array<T, N> const& lhs, sprout::array<T, N> const& rhs);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| true if the contents of the lhs are lexicographically greater than the contents of rhs, false otherwise.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. 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 = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
|
||||
static_assert(y > x, "y is greater than x.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/array/comparison.hpp``
|
||||
| Convenience header: ``sprout/array.hpp``
|
||||
|
40
source/libs/array/array/operator-greater_equal.rst
Normal file
40
source/libs/array/array/operator-greater_equal.rst
Normal file
|
@ -0,0 +1,40 @@
|
|||
.. _sprout-array-array-operator-greater_equal:
|
||||
###############################################################################
|
||||
operator>=
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator>=(sprout::array<T, N> const& lhs, sprout::array<T, N> const& rhs);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| true if the contents of the lhs are lexicographically greater than or equal the contents of rhs, false otherwise.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. 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 = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
|
||||
static_assert(y >= x, "y is greater than or equal to x.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/array/comparison.hpp``
|
||||
| Convenience header: ``sprout/array.hpp``
|
||||
|
40
source/libs/array/array/operator-less.rst
Normal file
40
source/libs/array/array/operator-less.rst
Normal file
|
@ -0,0 +1,40 @@
|
|||
.. _sprout-array-array-operator-less:
|
||||
###############################################################################
|
||||
operator<
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator<(sprout::array<T, N> const& lhs, sprout::array<T, N> const& rhs);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| true if the contents of the lhs are lexicographically less than the contents of rhs, false otherwise.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. 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 = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
|
||||
static_assert(x < y, "x is less than y.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/array/comparison.hpp``
|
||||
| Convenience header: ``sprout/array.hpp``
|
||||
|
40
source/libs/array/array/operator-less_equal.rst
Normal file
40
source/libs/array/array/operator-less_equal.rst
Normal file
|
@ -0,0 +1,40 @@
|
|||
.. _sprout-array-array-operator-less_equal:
|
||||
###############################################################################
|
||||
operator<=
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator<=(sprout::array<T, N> const& lhs, sprout::array<T, N> const& rhs);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| true if the contents of the lhs are lexicographically less than or equal the contents of rhs, false otherwise.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. 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 = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
|
||||
static_assert(x <= y, "x is less than or equal to y.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/array/comparison.hpp``
|
||||
| Convenience header: ``sprout/array.hpp``
|
||||
|
40
source/libs/array/array/operator-not_equal_to.rst
Normal file
40
source/libs/array/array/operator-not_equal_to.rst
Normal file
|
@ -0,0 +1,40 @@
|
|||
.. _sprout-array-array-operator-not_equal_to:
|
||||
###############################################################################
|
||||
operator!=
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
operator!=(sprout::array<T, N> const& lhs, sprout::array<T, N> const& rhs);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| true if the contents of the containers are not equivalent, false otherwise.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. 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 = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
|
||||
static_assert(x != y, "x is not equal to y.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/array/comparison.hpp``
|
||||
| Convenience header: ``sprout/array.hpp``
|
||||
|
44
source/libs/array/array/operator-subscript.rst
Normal file
44
source/libs/array/array/operator-subscript.rst
Normal 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``
|
||||
|
39
source/libs/array/array/rbegin.rst
Normal file
39
source/libs/array/array/rbegin.rst
Normal 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``
|
||||
|
39
source/libs/array/array/rend.rst
Normal file
39
source/libs/array/array/rend.rst
Normal 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``
|
||||
|
37
source/libs/array/array/size.rst
Normal file
37
source/libs/array/array/size.rst
Normal 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``
|
||||
|
48
source/libs/array/array/swap-global.rst
Normal file
48
source/libs/array/array/swap-global.rst
Normal file
|
@ -0,0 +1,48 @@
|
|||
.. _sprout-array-array-swap-global:
|
||||
###############################################################################
|
||||
swap
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
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)));
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| ``lhs.swap(rhs)``.
|
||||
|
||||
Throws
|
||||
========================================
|
||||
|
||||
| Nothing unless ``lhs.swap(rhs)`` 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}};
|
||||
swap(x, y);
|
||||
SPROUT_ASSERT_MSG(x[0] = 10 && y[0] == 1, "each element are swapped.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| linear in N.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/array/array.hpp``
|
||||
| Convenience header: ``sprout/array.hpp``
|
||||
|
45
source/libs/array/array/swap.rst
Normal file
45
source/libs/array/array/swap.rst
Normal file
|
@ -0,0 +1,45 @@
|
|||
.. _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&>())));
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| ``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 in N.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/array/array.hpp``
|
||||
| Convenience header: ``sprout/array.hpp``
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue