mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-06 14:24:09 +00:00
add doc: find algorithms
This commit is contained in:
parent
5569c6d50c
commit
6f3e65071e
44 changed files with 1008 additions and 171 deletions
|
@ -14,7 +14,7 @@ Interface
|
|||
Returns
|
||||
========================================
|
||||
|
||||
*true* if [first,last) is empty or if ``pred(*i)`` is true for every iterator i in the range [first,last), and *false* otherwise.
|
||||
| *true* if [first,last) is empty or if ``pred(*i)`` is true for every iterator i in the range [first,last), and *false* otherwise.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
|
@ -33,14 +33,12 @@ Examples
|
|||
Complexity
|
||||
========================================
|
||||
|
||||
At most ``last - first`` applications of the predicate.
|
||||
|
||||
Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
| At most ``last - first`` applications of the predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
``sprout/algorithm/all_of.hpp``
|
||||
|
||||
Convenience header: ``sprout/algorithm.hpp``
|
||||
| ``sprout/algorithm/all_of.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ Interface
|
|||
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.
|
||||
| *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
|
||||
========================================
|
||||
|
@ -32,14 +32,12 @@ Examples
|
|||
Complexity
|
||||
========================================
|
||||
|
||||
At most ``last - first`` applications of the predicate.
|
||||
|
||||
Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
| 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``
|
||||
| ``sprout/algorithm/all_of_equal.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ Interface
|
|||
Returns
|
||||
========================================
|
||||
|
||||
*false* if [first,last) is empty or if there is no iterator i in the range [first,last) such that ``pred(*i)`` is true, and *true* otherwise.
|
||||
| *false* if [first,last) is empty or if there is no iterator i in the range [first,last) such that ``pred(*i)`` is true, and *true* otherwise.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
|
@ -33,14 +33,12 @@ Examples
|
|||
Complexity
|
||||
========================================
|
||||
|
||||
At most ``last - first`` applications of the predicate.
|
||||
|
||||
Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
| At most ``last - first`` applications of the predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
``sprout/algorithm/any_of.hpp``
|
||||
|
||||
Convenience header: ``sprout/algorithm.hpp``
|
||||
| ``sprout/algorithm/any_of.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ Interface
|
|||
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.
|
||||
| *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
|
||||
========================================
|
||||
|
@ -32,14 +32,12 @@ Examples
|
|||
Complexity
|
||||
========================================
|
||||
|
||||
At most ``last - first`` applications of the predicate.
|
||||
|
||||
Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
| 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``
|
||||
| ``sprout/algorithm/any_of_equal.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
||||
|
|
45
docs/_sources/libs/sprout/algorithm/find.txt
Normal file
45
docs/_sources/libs/sprout/algorithm/find.txt
Normal file
|
@ -0,0 +1,45 @@
|
|||
.. _sprout-algorithm-find:
|
||||
###############################################################################
|
||||
find
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename InputIterator, typename T>
|
||||
inline SPROUT_CONSTEXPR InputIterator
|
||||
find(InputIterator first, InputIterator last, T const& value);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| The first iterator i in the range [first,last) for which the following corresponding conditions hold: ``*i == value``.
|
||||
| Returns last if no such iterator is found.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/find.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::find(begin(input), end(input), 8);
|
||||
static_assert(result != end(input), "found a element equal to 8 from input.");
|
||||
static_assert(*result == 8, "a found iterator is pointing to 8.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| At most ``last - first`` applications of the predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/find.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
46
docs/_sources/libs/sprout/algorithm/find_if.txt
Normal file
46
docs/_sources/libs/sprout/algorithm/find_if.txt
Normal file
|
@ -0,0 +1,46 @@
|
|||
.. _sprout-algorithm-find_if:
|
||||
###############################################################################
|
||||
find_if
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename InputIterator, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR InputIterator
|
||||
find_if(InputIterator first, InputIterator last, Predicate pred);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| The first iterator i in the range [first,last) for which the following corresponding conditions hold: ``pred(*i)``.
|
||||
| Returns last if no such iterator is found.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/find_if.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
#include <sprout/functional.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::find_if(begin(input), end(input), bind2nd(greater<>(), 7));
|
||||
static_assert(result != end(input), "found a element greater than 7 from input.");
|
||||
static_assert(*result == 8, "a found iterator is pointing to 8.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| At most ``last - first`` applications of the predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/find_if.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
46
docs/_sources/libs/sprout/algorithm/find_if_not.txt
Normal file
46
docs/_sources/libs/sprout/algorithm/find_if_not.txt
Normal file
|
@ -0,0 +1,46 @@
|
|||
.. _sprout-algorithm-find_if_not:
|
||||
###############################################################################
|
||||
find_if_not
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename InputIterator, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR InputIterator
|
||||
find_if_not(InputIterator first, InputIterator last, Predicate pred);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| The first iterator i in the range [first,last) for which the following corresponding conditions hold: ``!pred(*i)``.
|
||||
| Returns last if no such iterator is found.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/find_if_not.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
#include <sprout/functional.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::find_if_not(begin(input), end(input), bind2nd(less<>(), 8));
|
||||
static_assert(result != end(input), "found a element not less than 8 from input.");
|
||||
static_assert(*result == 8, "a found iterator is pointing to 8.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| At most ``last - first`` applications of the predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/find_if_not.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
|
@ -14,6 +14,9 @@ Sprout.Algorithm
|
|||
none_of_equal
|
||||
one_of
|
||||
one_of_equal
|
||||
find
|
||||
find_if
|
||||
find_if_not
|
||||
|
||||
.. _sprout-algorithm-non_modifying:
|
||||
*******************************************************************************
|
||||
|
|
|
@ -14,7 +14,7 @@ Interface
|
|||
Returns
|
||||
========================================
|
||||
|
||||
*true* if [first,last) is empty or if ``pred(*i)`` is false for every iterator i in the range [first,last), and *false* otherwise.
|
||||
| *true* if [first,last) is empty or if ``pred(*i)`` is false for every iterator i in the range [first,last), and *false* otherwise.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
|
@ -33,14 +33,12 @@ Examples
|
|||
Complexity
|
||||
========================================
|
||||
|
||||
At most ``last - first`` applications of the predicate.
|
||||
|
||||
Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
| At most ``last - first`` applications of the predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
``sprout/algorithm/none_of.hpp``
|
||||
|
||||
Convenience header: ``sprout/algorithm.hpp``
|
||||
| ``sprout/algorithm/none_of.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ Interface
|
|||
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.
|
||||
| *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
|
||||
========================================
|
||||
|
@ -32,14 +32,12 @@ Examples
|
|||
Complexity
|
||||
========================================
|
||||
|
||||
At most ``last - first`` applications of the predicate.
|
||||
|
||||
Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
| 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``
|
||||
| ``sprout/algorithm/none_of_equal.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ Interface
|
|||
Returns
|
||||
========================================
|
||||
|
||||
*true* if [first,last) is not empty and there is only one iterator i in the range [first,last) such that ``pred(*i)`` is true, and *false* otherwise.
|
||||
| *true* if [first,last) is not empty and there is only one iterator i in the range [first,last) such that ``pred(*i)`` is true, and *false* otherwise.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
|
@ -33,14 +33,12 @@ Examples
|
|||
Complexity
|
||||
========================================
|
||||
|
||||
At most ``last - first`` applications of the predicate.
|
||||
|
||||
Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
| At most ``last - first`` applications of the predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
``sprout/algorithm/one_of.hpp``
|
||||
|
||||
Convenience header: ``sprout/algorithm.hpp``
|
||||
| ``sprout/algorithm/one_of.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ Interface
|
|||
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.
|
||||
| *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
|
||||
========================================
|
||||
|
@ -32,14 +32,12 @@ Examples
|
|||
Complexity
|
||||
========================================
|
||||
|
||||
At most ``last - first`` applications of the predicate.
|
||||
|
||||
Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
| 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``
|
||||
| ``sprout/algorithm/one_of_equal.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue