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

add doc: array comparisons

This commit is contained in:
Bolero-MURAKAMI 2013-08-29 22:39:54 +09:00
parent ed85c56acc
commit 4b21f64ea9
30 changed files with 1839 additions and 95 deletions

View 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``

View 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``

View 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``

View 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``

View 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``

View 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``

View file

@ -0,0 +1,49 @@
.. _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(y)``.
Throws
========================================
| Nothing unless ``lhs.swap(y)`` 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.
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/array.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -9,7 +9,7 @@ Interface
void swap(array& y) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::swap(std::declval<T&>(), std::declval<T&>())));
Returns
Effects
========================================
| ``swap_ranges(begin(), end(), y.begin())``.
@ -35,7 +35,7 @@ Examples
Complexity
========================================
| Linear.
| linear in N.
| Recursive function invocations in *O(1)* (constant) depth.
Header

View file

@ -7,6 +7,13 @@ Sprout.Array
:hidden:
array/index
array/swap-global
array/operator-equal_to
array/operator-not_equal_to
array/operator-less
array/operator-greater
array/operator-less_equal
array/operator-greater_equal
to_array
make_array
make_common_array
@ -26,17 +33,6 @@ class
Non-member functions
----------------------------------------
array generators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
============================================================ ===============================================================================
function
============================================================ ===============================================================================
:doc:`to_array <./to_array>`
:doc:`make_array <./make_array>`
:doc:`make_common_array <./make_common_array>`
============================================================ ===============================================================================
specialized algorithms
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -60,6 +56,17 @@ function
:doc:`operator= <./array/operator-greater_equal>`
============================================================ ===============================================================================
array generators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
============================================================ ===============================================================================
function
============================================================ ===============================================================================
:doc:`to_array <./to_array>`
:doc:`make_array <./make_array>`
:doc:`make_common_array <./make_common_array>`
============================================================ ===============================================================================
Tuple interface
----------------------------------------