add doc: 4 non-modifying algorithms

This commit is contained in:
Bolero-MURAKAMI 2013-08-19 23:55:46 +09:00
parent b6835b636f
commit 5569c6d50c
20 changed files with 1271 additions and 31 deletions

View file

@ -0,0 +1,45 @@
.. _sprout-algorithm-all_of_equal:
###############################################################################
all_of_equal
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename InputIterator, typename T>
inline SPROUT_CONSTEXPR bool
all_of_equal(InputIterator first, InputIterator last, T const& value);
Returns
========================================
*true* if [first,last) is empty or if ``*i == value`` is true for every iterator i in the range [first,last), and *false* otherwise.
Examples
========================================
.. sourcecode:: c++
#include <sprout/algorithm/all_of_equal.hpp>
#include <sprout/array.hpp>
#include <sprout/container.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}};
SPROUT_STATIC_CONSTEXPR auto result = sprout::all_of_equal(begin(input), end(input), 1);
static_assert(result, "all of input is equal to 1.");
Complexity
========================================
At most ``last - first`` applications of the predicate.
Recursive function invocations in *O(logN)* (logarithmic) depth.
Header
========================================
``sprout/algorithm/all_of_equal.hpp``
Convenience header: ``sprout/algorithm.hpp``

View file

@ -0,0 +1,45 @@
.. _sprout-algorithm-any_of_equal:
###############################################################################
any_of_equal
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename InputIterator, typename T>
inline SPROUT_CONSTEXPR bool
any_of_equal(InputIterator first, InputIterator last, T const& value);
Returns
========================================
*false* if [first,last) is empty or if there is no iterator i in the range [first,last) such that ``*i == value`` is true, and *true* otherwise.
Examples
========================================
.. sourcecode:: c++
#include <sprout/algorithm/any_of_equal.hpp>
#include <sprout/array.hpp>
#include <sprout/container.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
SPROUT_STATIC_CONSTEXPR auto result = sprout::any_of_equal(begin(input), end(input), 1);
static_assert(result, "any of input is equal to 1.");
Complexity
========================================
At most ``last - first`` applications of the predicate.
Recursive function invocations in *O(logN)* (logarithmic) depth.
Header
========================================
``sprout/algorithm/any_of_equal.hpp``
Convenience header: ``sprout/algorithm.hpp``

View file

@ -7,9 +7,13 @@ Sprout.Algorithm
:hidden:
all_of
all_of_equal
any_of
any_of_equal
none_of
none_of_equal
one_of
one_of_equal
.. _sprout-algorithm-non_modifying:
*******************************************************************************
@ -17,9 +21,84 @@ 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:`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>`
.. _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>`
.. _sprout-algorithm-non_modifying-heap:
Heap operations
========================================
* :doc:`is_heap_until <./is_heap_until>`
* :doc:`is_heap <./is_heap>`
.. _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>`
.. _sprout-algorithm-non_modifying-lexicographical:
Lexicographical comparison
========================================
* :doc:`lexicographical_compare <./lexicographical_compare>`
* :doc:`tristate_lexicographical_compare <./tristate_lexicographical_compare>`
.. _sprout-algorithm-non_modifying-permutation:
Permutation generators
========================================
* :doc:`next_permutation <./next_permutation>`
* :doc:`prev_permutation <./prev_permutation>`
* :doc:`is_permutation <./is_permutation>`
.. _sprout-algorithm-non_modifying-clamp:
Clamp algorithm
========================================
* :doc:`clamp <./clamp>`
Header
========================================

View file

@ -0,0 +1,45 @@
.. _sprout-algorithm-none_of_equal:
###############################################################################
none_of_equal
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename InputIterator, typename T>
inline SPROUT_CONSTEXPR bool
none_of_equal(InputIterator first, InputIterator last, T const& value);
Returns
========================================
*true* if [first,last) is empty or if ``*i == value`` is false for every iterator i in the range [first,last), and *false* otherwise.
Examples
========================================
.. sourcecode:: c++
#include <sprout/algorithm/none_of_equal.hpp>
#include <sprout/array.hpp>
#include <sprout/container.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
SPROUT_STATIC_CONSTEXPR auto result = sprout::none_of_equal(begin(input), end(input), 11);
static_assert(result, "none of input is equal to 11.");
Complexity
========================================
At most ``last - first`` applications of the predicate.
Recursive function invocations in *O(logN)* (logarithmic) depth.
Header
========================================
``sprout/algorithm/none_of_equal.hpp``
Convenience header: ``sprout/algorithm.hpp``

View file

@ -0,0 +1,45 @@
.. _sprout-algorithm-one_of_equal:
###############################################################################
one_of_equal
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename InputIterator, typename T>
inline SPROUT_CONSTEXPR bool
one_of_equal(InputIterator first, InputIterator last, T const& value);
Returns
========================================
*true* if [first,last) is not empty and there is only one iterator i in the range [first,last) such that ``*i == value`` is true, and *false* otherwise.
Examples
========================================
.. sourcecode:: c++
#include <sprout/algorithm/one_of_equal.hpp>
#include <sprout/array.hpp>
#include <sprout/container.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
SPROUT_STATIC_CONSTEXPR auto result = sprout::one_of_equal(begin(input), end(input), 1);
static_assert(result, "one of input is equal to 1.");
Complexity
========================================
At most ``last - first`` applications of the predicate.
Recursive function invocations in *O(logN)* (logarithmic) depth.
Header
========================================
``sprout/algorithm/one_of_equal.hpp``
Convenience header: ``sprout/algorithm.hpp``