mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-05-10 09:23:30 +00:00
add doc: all non-modifying sequence operation
This commit is contained in:
parent
d58e8ce805
commit
c5af780d6b
26 changed files with 2104 additions and 10 deletions
43
docs/_sources/libs/sprout/algorithm/count.txt
Normal file
43
docs/_sources/libs/sprout/algorithm/count.txt
Normal file
|
@ -0,0 +1,43 @@
|
|||
.. _sprout-algorithm-count:
|
||||
###############################################################################
|
||||
count
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename InputIterator, typename T>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
count(InputIterator first, InputIterator last, T const& value);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| The number of iterators i in the range [first,last) for which the following corresponding conditions hold: ``*i == value``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/count.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 5, 5, 5, 5, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::count(begin(input), end(input), 5);
|
||||
static_assert(result == 4, "counted 4 elements equal to 5 from input.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Exactly ``last - first`` applications of the predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/count.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
44
docs/_sources/libs/sprout/algorithm/count_if.txt
Normal file
44
docs/_sources/libs/sprout/algorithm/count_if.txt
Normal file
|
@ -0,0 +1,44 @@
|
|||
.. _sprout-algorithm-count_if:
|
||||
###############################################################################
|
||||
count_if
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename InputIterator, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
count_if(InputIterator first, InputIterator last, Predicate pred);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| The number of iterators i in the range [first,last) for which the following corresponding conditions hold: ``pred(*i)``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/count_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::count_if(begin(input), end(input), bind2nd(modulus<>(), 2));
|
||||
static_assert(result == 5, "counted 5 elements of odd number from input.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Exactly ``last - first`` applications of the predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/count_if.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
64
docs/_sources/libs/sprout/algorithm/equal.txt
Normal file
64
docs/_sources/libs/sprout/algorithm/equal.txt
Normal file
|
@ -0,0 +1,64 @@
|
|||
.. _sprout-algorithm-equal:
|
||||
###############################################################################
|
||||
equal
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate pred);
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred);
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
|
||||
|
||||
Remarks
|
||||
========================================
|
||||
|
||||
| If last2 was not given in the argument list, it denotes ``first2 + (last1 - first1)`` below.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| If ``last1 - first1 != last2 - first2``, return false.
|
||||
| Otherwise return true if for every iterator i in the range [first1,last1) the following corresponding conditions hold: ``*i == *(first2 + (i - first1))``, ``pred(*i, *(first2 + (i - first1)))``.
|
||||
| Otherwise, returns false.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/equal.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input1 = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto input2 = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::equal(begin(input1), end(input1), begin(input2), end(input2));
|
||||
static_assert(result, "input2 equals to input1.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| No applications of the corresponding predicate if InputIterator1 and InputIterator2 meet the requirements of random access iterators and ``last1 - first1 != last2 - first2``.
|
||||
| Otherwise, at most ``min(last1 - first1, last2 - first2)`` applications of the corresponding predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/equal.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
|
@ -20,6 +20,13 @@ Sprout.Algorithm
|
|||
find_end
|
||||
find_first_of
|
||||
adjacent_find
|
||||
count
|
||||
count_if
|
||||
mismatch
|
||||
equal
|
||||
is_permutation
|
||||
search
|
||||
search_n
|
||||
|
||||
.. _sprout-algorithm-non_modifying:
|
||||
*******************************************************************************
|
||||
|
@ -44,6 +51,7 @@ Non-modifying sequence operations
|
|||
* :doc:`count_if <./count_if>`
|
||||
* :doc:`mismatch <./mismatch>`
|
||||
* :doc:`equal <./equal>`
|
||||
* :doc:`is_permutation <./is_permutation>`
|
||||
* :doc:`search <./search>`
|
||||
* :doc:`search_n <./search_n>`
|
||||
|
||||
|
@ -98,7 +106,6 @@ Permutation generators
|
|||
|
||||
* :doc:`next_permutation <./next_permutation>`
|
||||
* :doc:`prev_permutation <./prev_permutation>`
|
||||
* :doc:`is_permutation <./is_permutation>`
|
||||
|
||||
.. _sprout-algorithm-non_modifying-clamp:
|
||||
Clamp algorithm
|
||||
|
|
63
docs/_sources/libs/sprout/algorithm/is_permutation.txt
Normal file
63
docs/_sources/libs/sprout/algorithm/is_permutation.txt
Normal file
|
@ -0,0 +1,63 @@
|
|||
.. _sprout-algorithm-is_permutation:
|
||||
###############################################################################
|
||||
is_permutation
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename ForwardIterator1, typename ForwardIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, BinaryPredicate pred);
|
||||
|
||||
template<typename ForwardIterator1, typename ForwardIterator2>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
|
||||
|
||||
template<typename ForwardIterator1, typename ForwardIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
|
||||
|
||||
template<typename ForwardIterator1, typename ForwardIterator2>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2) {
|
||||
|
||||
Remarks
|
||||
========================================
|
||||
|
||||
| If last2 was not given in the argument list, it denotes ``first2 + (last1 - first1)`` below.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| If ``last1 - first1 != last2 - first2``, return false.
|
||||
| Otherwise return true if there exists a permutation of the elements in the range [first2,first2 + (last1 - first1)), beginning with ForwardIterator2 begin, such that ``equal(first1, last1, begin)`` returns true or ``equal(first1, last1, begin, pred)`` returns true; otherwise, returns false.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/is_permutation.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input1 = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto input2 = array<int, 10>{{10, 9, 8, 1, 2, 3, 4, 5, 6, 7}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::is_permutation(begin(input1), end(input1), begin(input2), end(input2));
|
||||
static_assert(result, "input2 is a permutation of input1.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| No applications of the corresponding predicate if ForwardIterator1 and ForwardIterator2 meet the requirements of random access iterators and ``last1 - first1 != last2 - first2``.
|
||||
| Otherwise, exactly distance(first1, last1) applications of the corresponding predicate if ``equal(first1, last1, first2, last2)`` would return true if pred was not given in the argument list or ``equal(first1, last1, first2, last2, pred)`` would return true if pred was given in the argument list; otherwise, at worst O(N^2), where N has the value ``distance(first1, last1)``.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/is_permutation.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
66
docs/_sources/libs/sprout/algorithm/mismatch.txt
Normal file
66
docs/_sources/libs/sprout/algorithm/mismatch.txt
Normal file
|
@ -0,0 +1,66 @@
|
|||
.. _sprout-algorithm-mismatch:
|
||||
###############################################################################
|
||||
mismatch
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<InputIterator1, InputIterator2>
|
||||
mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate pred);
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<InputIterator1, InputIterator2>
|
||||
mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2;
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<InputIterator1, InputIterator2>
|
||||
mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<InputIterator1, InputIterator2>
|
||||
mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred);
|
||||
|
||||
Remarks
|
||||
========================================
|
||||
|
||||
| If last2 was not given in the argument list, it denotes ``first2 + (last1 - first1)`` below.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| A pair of iterators i and j such that ``j == first2 + (i - first1)`` and i is the first iterator in the range [first1,last1) for which the following corresponding conditions hold:
|
||||
* j is in the range [first2,last2).
|
||||
* ``!(*i == *(first2 + (i - first1)))``
|
||||
* ``!pred(*i, *(first2 + (i - first1)))``
|
||||
| Returns the pair ``first1 + min(last1 - first1, last2 - first2)`` and ``first2 + min(last1 - first1, last2 - first2)`` if such an iterator i is not found.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/mismatch.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input1 = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto input2 = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 10, 9, 8}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::mismatch(begin(input1), end(input1), begin(input2), end(input2));
|
||||
static_assert(result.first != end(input1) && result.second != end(input2), "input2 mismatches with input1.");
|
||||
static_assert(result.first - begin(input1) == 7, "a mismatched position is 7.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| At most ``last1 - first1`` applications of the corresponding predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/mismatch.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
62
docs/_sources/libs/sprout/algorithm/search.txt
Normal file
62
docs/_sources/libs/sprout/algorithm/search.txt
Normal file
|
@ -0,0 +1,62 @@
|
|||
.. _sprout-algorithm-search:
|
||||
###############################################################################
|
||||
search
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename ForwardIterator1, typename ForwardIterator2>
|
||||
inline SPROUT_CONSTEXPR ForwardIterator1
|
||||
search(
|
||||
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
|
||||
);
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| Finds a subsequence of equal values in a sequence.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| The first iterator i in the range [first1,last1 - (last2-first2)) such that for any nonnegative integer n less than ``last2 - first2`` the following corresponding conditions hold: ``*(i + n) == *(first2 + n)``, ``pred(*(i + n), *(first2 + n))``.
|
||||
| Returns first1 if [first2,last2) is empty, otherwise returns last1 if no such iterator is found.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/search.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input1 = array<int, 10>{{1, 2, 3, 4, 5, 1, 2, 3, 4, 5}};
|
||||
SPROUT_STATIC_CONSTEXPR auto input2 = array<int, 3>{{3, 4, 5}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::search(begin(input1), end(input1), begin(input2), end(input2));
|
||||
static_assert(result != end(input1), "found a subsequence equal to input2 from input1.");
|
||||
static_assert(result - begin(input1) == 2, "a found position is 2.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| At most ``(last1 - first1) * (last2 - first2)`` applications of the corresponding predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/search.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
59
docs/_sources/libs/sprout/algorithm/search_n.txt
Normal file
59
docs/_sources/libs/sprout/algorithm/search_n.txt
Normal file
|
@ -0,0 +1,59 @@
|
|||
.. _sprout-algorithm-search_n:
|
||||
###############################################################################
|
||||
search_n
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename ForwardIterator, typename Size, typename T>
|
||||
inline SPROUT_CONSTEXPR ForwardIterator
|
||||
search_n(ForwardIterator first, ForwardIterator last, Size count, T const& value);
|
||||
|
||||
template<typename ForwardIterator, typename Size, typename T, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR ForwardIterator
|
||||
search_n(ForwardIterator first, ForwardIterator last, Size count, T const& value, BinaryPredicate pred);
|
||||
|
||||
Requires
|
||||
========================================
|
||||
|
||||
| The type Size shall be convertible to integral type.
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| Finds a subsequence of equal values in a sequence.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| The first iterator i in the range [first,last-count) such that for any non-negative integer n less than count the following corresponding conditions hold: ``*(i + n) == value``, ``pred(*(i + n),value)``.
|
||||
| Returns last if no such iterator is found.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/search_n.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input1 = array<int, 10>{{1, 2, 3, 5, 5, 5, 5, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::search_n(begin(input1), end(input1), 4, 5);
|
||||
static_assert(result != end(input1), "found a subsequence equal to 4 values of 5 from input1.");
|
||||
static_assert(result - begin(input1) == 3, "a found position is 3.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| At most ``last - first`` applications of the corresponding predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/search_n.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
|
@ -21,6 +21,7 @@
|
|||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<link rel="top" title="Sprout v1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="Sprout.Algorithm" href="index.html" />
|
||||
<link rel="next" title="count" href="count.html" />
|
||||
<link rel="prev" title="find_first_of" href="find_first_of.html" />
|
||||
</head>
|
||||
<body>
|
||||
|
@ -30,6 +31,9 @@
|
|||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="count.html" title="count"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="find_first_of.html" title="find_first_of"
|
||||
accesskey="P">previous</a> |</li>
|
||||
|
@ -117,6 +121,9 @@
|
|||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="find_first_of.html"
|
||||
title="previous chapter">find_first_of</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="count.html"
|
||||
title="next chapter">count</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/libs/sprout/algorithm/adjacent_find.txt"
|
||||
|
@ -145,6 +152,9 @@
|
|||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="count.html" title="count"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="find_first_of.html" title="find_first_of"
|
||||
>previous</a> |</li>
|
||||
|
|
166
docs/libs/sprout/algorithm/count.html
Normal file
166
docs/libs/sprout/algorithm/count.html
Normal file
|
@ -0,0 +1,166 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>count — Sprout v1.0 documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '../../../',
|
||||
VERSION: '1.0',
|
||||
COLLAPSE_MODINDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<link rel="top" title="Sprout v1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="Sprout.Algorithm" href="index.html" />
|
||||
<link rel="next" title="count_if" href="count_if.html" />
|
||||
<link rel="prev" title="adjacent_find" href="adjacent_find.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="count_if.html" title="count_if"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="adjacent_find.html" title="adjacent_find"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout v1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Sprout C++ Libraries</a> »</li>
|
||||
<li><a href="../../libraries.html" >Libraries</a> »</li>
|
||||
<li><a href="index.html" accesskey="U">Sprout.Algorithm</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="count">
|
||||
<h1>count<a class="headerlink" href="#count" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="interface">
|
||||
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">InputIterator</span><span class="p">,</span> <span class="k">typename</span> <span class="n">T</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="k">typename</span> <span class="n">std</span><span class="o">::</span><span class="n">iterator_traits</span><span class="o"><</span><span class="n">InputIterator</span><span class="o">>::</span><span class="n">difference_type</span>
|
||||
<span class="n">count</span><span class="p">(</span><span class="n">InputIterator</span> <span class="n">first</span><span class="p">,</span> <span class="n">InputIterator</span> <span class="n">last</span><span class="p">,</span> <span class="n">T</span> <span class="k">const</span><span class="o">&</span> <span class="n">value</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="returns">
|
||||
<h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">The number of iterators i in the range [first,last) for which the following corresponding conditions hold: <tt class="docutils literal"><span class="pre">*i</span> <span class="pre">==</span> <span class="pre">value</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="examples">
|
||||
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include <sprout/algorithm/count.hpp></span>
|
||||
<span class="cp">#include <sprout/array.hpp></span>
|
||||
<span class="cp">#include <sprout/container.hpp></span>
|
||||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</span><span class="p">}};</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">result</span> <span class="o">=</span> <span class="n">sprout</span><span class="o">::</span><span class="n">count</span><span class="p">(</span><span class="n">begin</span><span class="p">(</span><span class="n">input</span><span class="p">),</span> <span class="n">end</span><span class="p">(</span><span class="n">input</span><span class="p">),</span> <span class="mi">5</span><span class="p">);</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">result</span> <span class="o">==</span> <span class="mi">4</span><span class="p">,</span> <span class="s">"counted 4 elements equal to 5 from input."</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="complexity">
|
||||
<h2>Complexity<a class="headerlink" href="#complexity" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">Exactly <tt class="docutils literal"><span class="pre">last</span> <span class="pre">-</span> <span class="pre">first</span></tt> applications of the predicate.</div>
|
||||
<div class="line">Recursive function invocations in <em>O(logN)</em> (logarithmic) depth.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="header">
|
||||
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">sprout/algorithm/count.hpp</span></tt></div>
|
||||
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/algorithm.hpp</span></tt></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../../../index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference external" href="#">count</a><ul>
|
||||
<li><a class="reference external" href="#interface">Interface</a></li>
|
||||
<li><a class="reference external" href="#returns">Returns</a></li>
|
||||
<li><a class="reference external" href="#examples">Examples</a></li>
|
||||
<li><a class="reference external" href="#complexity">Complexity</a></li>
|
||||
<li><a class="reference external" href="#header">Header</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="adjacent_find.html"
|
||||
title="previous chapter">adjacent_find</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="count_if.html"
|
||||
title="next chapter">count_if</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/libs/sprout/algorithm/count.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" size="18" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="count_if.html" title="count_if"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="adjacent_find.html" title="adjacent_find"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout v1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Sprout C++ Libraries</a> »</li>
|
||||
<li><a href="../../libraries.html" >Libraries</a> »</li>
|
||||
<li><a href="index.html" >Sprout.Algorithm</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2013, Bolero MURAKAMI.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.4.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
167
docs/libs/sprout/algorithm/count_if.html
Normal file
167
docs/libs/sprout/algorithm/count_if.html
Normal file
|
@ -0,0 +1,167 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>count_if — Sprout v1.0 documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '../../../',
|
||||
VERSION: '1.0',
|
||||
COLLAPSE_MODINDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<link rel="top" title="Sprout v1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="Sprout.Algorithm" href="index.html" />
|
||||
<link rel="next" title="mismatch" href="mismatch.html" />
|
||||
<link rel="prev" title="count" href="count.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="mismatch.html" title="mismatch"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="count.html" title="count"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout v1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Sprout C++ Libraries</a> »</li>
|
||||
<li><a href="../../libraries.html" >Libraries</a> »</li>
|
||||
<li><a href="index.html" accesskey="U">Sprout.Algorithm</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="count-if">
|
||||
<h1>count_if<a class="headerlink" href="#count-if" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="interface">
|
||||
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">InputIterator</span><span class="p">,</span> <span class="k">typename</span> <span class="n">Predicate</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="k">typename</span> <span class="n">std</span><span class="o">::</span><span class="n">iterator_traits</span><span class="o"><</span><span class="n">InputIterator</span><span class="o">>::</span><span class="n">difference_type</span>
|
||||
<span class="n">count_if</span><span class="p">(</span><span class="n">InputIterator</span> <span class="n">first</span><span class="p">,</span> <span class="n">InputIterator</span> <span class="n">last</span><span class="p">,</span> <span class="n">Predicate</span> <span class="n">pred</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="returns">
|
||||
<h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">The number of iterators i in the range [first,last) for which the following corresponding conditions hold: <tt class="docutils literal"><span class="pre">pred(*i)</span></tt>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="examples">
|
||||
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include <sprout/algorithm/count_if.hpp></span>
|
||||
<span class="cp">#include <sprout/array.hpp></span>
|
||||
<span class="cp">#include <sprout/container.hpp></span>
|
||||
<span class="cp">#include <sprout/functional.hpp></span>
|
||||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</span><span class="p">}};</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">result</span> <span class="o">=</span> <span class="n">sprout</span><span class="o">::</span><span class="n">count_if</span><span class="p">(</span><span class="n">begin</span><span class="p">(</span><span class="n">input</span><span class="p">),</span> <span class="n">end</span><span class="p">(</span><span class="n">input</span><span class="p">),</span> <span class="n">bind2nd</span><span class="p">(</span><span class="n">modulus</span><span class="o"><></span><span class="p">(),</span> <span class="mi">2</span><span class="p">));</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">result</span> <span class="o">==</span> <span class="mi">5</span><span class="p">,</span> <span class="s">"counted 5 elements of odd number from input."</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="complexity">
|
||||
<h2>Complexity<a class="headerlink" href="#complexity" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">Exactly <tt class="docutils literal"><span class="pre">last</span> <span class="pre">-</span> <span class="pre">first</span></tt> applications of the predicate.</div>
|
||||
<div class="line">Recursive function invocations in <em>O(logN)</em> (logarithmic) depth.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="header">
|
||||
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">sprout/algorithm/count_if.hpp</span></tt></div>
|
||||
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/algorithm.hpp</span></tt></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../../../index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference external" href="#">count_if</a><ul>
|
||||
<li><a class="reference external" href="#interface">Interface</a></li>
|
||||
<li><a class="reference external" href="#returns">Returns</a></li>
|
||||
<li><a class="reference external" href="#examples">Examples</a></li>
|
||||
<li><a class="reference external" href="#complexity">Complexity</a></li>
|
||||
<li><a class="reference external" href="#header">Header</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="count.html"
|
||||
title="previous chapter">count</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="mismatch.html"
|
||||
title="next chapter">mismatch</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/libs/sprout/algorithm/count_if.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" size="18" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="mismatch.html" title="mismatch"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="count.html" title="count"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout v1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Sprout C++ Libraries</a> »</li>
|
||||
<li><a href="../../libraries.html" >Libraries</a> »</li>
|
||||
<li><a href="index.html" >Sprout.Algorithm</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2013, Bolero MURAKAMI.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.4.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
189
docs/libs/sprout/algorithm/equal.html
Normal file
189
docs/libs/sprout/algorithm/equal.html
Normal file
|
@ -0,0 +1,189 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>equal — Sprout v1.0 documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '../../../',
|
||||
VERSION: '1.0',
|
||||
COLLAPSE_MODINDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<link rel="top" title="Sprout v1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="Sprout.Algorithm" href="index.html" />
|
||||
<link rel="next" title="is_permutation" href="is_permutation.html" />
|
||||
<link rel="prev" title="mismatch" href="mismatch.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="is_permutation.html" title="is_permutation"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="mismatch.html" title="mismatch"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout v1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Sprout C++ Libraries</a> »</li>
|
||||
<li><a href="../../libraries.html" >Libraries</a> »</li>
|
||||
<li><a href="index.html" accesskey="U">Sprout.Algorithm</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="equal">
|
||||
<h1>equal<a class="headerlink" href="#equal" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="interface">
|
||||
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">InputIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">InputIterator2</span><span class="p">,</span> <span class="k">typename</span> <span class="n">BinaryPredicate</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">bool</span>
|
||||
<span class="n">equal</span><span class="p">(</span><span class="n">InputIterator1</span> <span class="n">first1</span><span class="p">,</span> <span class="n">InputIterator1</span> <span class="n">last1</span><span class="p">,</span> <span class="n">InputIterator2</span> <span class="n">first2</span><span class="p">,</span> <span class="n">BinaryPredicate</span> <span class="n">pred</span><span class="p">);</span>
|
||||
|
||||
<span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">InputIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">InputIterator2</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">bool</span>
|
||||
<span class="n">equal</span><span class="p">(</span><span class="n">InputIterator1</span> <span class="n">first1</span><span class="p">,</span> <span class="n">InputIterator1</span> <span class="n">last1</span><span class="p">,</span> <span class="n">InputIterator2</span> <span class="n">first2</span><span class="p">);</span>
|
||||
|
||||
<span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">InputIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">InputIterator2</span><span class="p">,</span> <span class="k">typename</span> <span class="n">BinaryPredicate</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">bool</span>
|
||||
<span class="n">equal</span><span class="p">(</span><span class="n">InputIterator1</span> <span class="n">first1</span><span class="p">,</span> <span class="n">InputIterator1</span> <span class="n">last1</span><span class="p">,</span> <span class="n">InputIterator2</span> <span class="n">first2</span><span class="p">,</span> <span class="n">InputIterator2</span> <span class="n">last2</span><span class="p">,</span> <span class="n">BinaryPredicate</span> <span class="n">pred</span><span class="p">);</span>
|
||||
|
||||
<span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">InputIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">InputIterator2</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">bool</span>
|
||||
<span class="n">equal</span><span class="p">(</span><span class="n">InputIterator1</span> <span class="n">first1</span><span class="p">,</span> <span class="n">InputIterator1</span> <span class="n">last1</span><span class="p">,</span> <span class="n">InputIterator2</span> <span class="n">first2</span><span class="p">,</span> <span class="n">InputIterator2</span> <span class="n">last2</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="remarks">
|
||||
<h2>Remarks<a class="headerlink" href="#remarks" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">If last2 was not given in the argument list, it denotes <tt class="docutils literal"><span class="pre">first2</span> <span class="pre">+</span> <span class="pre">(last1</span> <span class="pre">-</span> <span class="pre">first1)</span></tt> below.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="returns">
|
||||
<h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">If <tt class="docutils literal"><span class="pre">last1</span> <span class="pre">-</span> <span class="pre">first1</span> <span class="pre">!=</span> <span class="pre">last2</span> <span class="pre">-</span> <span class="pre">first2</span></tt>, return false.</div>
|
||||
<div class="line">Otherwise return true if for every iterator i in the range [first1,last1) the following corresponding conditions hold: <tt class="docutils literal"><span class="pre">*i</span> <span class="pre">==</span> <span class="pre">*(first2</span> <span class="pre">+</span> <span class="pre">(i</span> <span class="pre">-</span> <span class="pre">first1))</span></tt>, <tt class="docutils literal"><span class="pre">pred(*i,</span> <span class="pre">*(first2</span> <span class="pre">+</span> <span class="pre">(i</span> <span class="pre">-</span> <span class="pre">first1)))</span></tt>.</div>
|
||||
<div class="line">Otherwise, returns false.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="examples">
|
||||
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include <sprout/algorithm/equal.hpp></span>
|
||||
<span class="cp">#include <sprout/array.hpp></span>
|
||||
<span class="cp">#include <sprout/container.hpp></span>
|
||||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input1</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</span><span class="p">}};</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input2</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</span><span class="p">}};</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">result</span> <span class="o">=</span> <span class="n">sprout</span><span class="o">::</span><span class="n">equal</span><span class="p">(</span><span class="n">begin</span><span class="p">(</span><span class="n">input1</span><span class="p">),</span> <span class="n">end</span><span class="p">(</span><span class="n">input1</span><span class="p">),</span> <span class="n">begin</span><span class="p">(</span><span class="n">input2</span><span class="p">),</span> <span class="n">end</span><span class="p">(</span><span class="n">input2</span><span class="p">));</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="s">"input2 equals to input1."</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="complexity">
|
||||
<h2>Complexity<a class="headerlink" href="#complexity" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">No applications of the corresponding predicate if InputIterator1 and InputIterator2 meet the requirements of random access iterators and <tt class="docutils literal"><span class="pre">last1</span> <span class="pre">-</span> <span class="pre">first1</span> <span class="pre">!=</span> <span class="pre">last2</span> <span class="pre">-</span> <span class="pre">first2</span></tt>.</div>
|
||||
<div class="line">Otherwise, at most <tt class="docutils literal"><span class="pre">min(last1</span> <span class="pre">-</span> <span class="pre">first1,</span> <span class="pre">last2</span> <span class="pre">-</span> <span class="pre">first2)</span></tt> applications of the corresponding predicate.</div>
|
||||
<div class="line">Recursive function invocations in <em>O(logN)</em> (logarithmic) depth.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="header">
|
||||
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">sprout/algorithm/equal.hpp</span></tt></div>
|
||||
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/algorithm.hpp</span></tt></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../../../index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference external" href="#">equal</a><ul>
|
||||
<li><a class="reference external" href="#interface">Interface</a></li>
|
||||
<li><a class="reference external" href="#remarks">Remarks</a></li>
|
||||
<li><a class="reference external" href="#returns">Returns</a></li>
|
||||
<li><a class="reference external" href="#examples">Examples</a></li>
|
||||
<li><a class="reference external" href="#complexity">Complexity</a></li>
|
||||
<li><a class="reference external" href="#header">Header</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="mismatch.html"
|
||||
title="previous chapter">mismatch</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="is_permutation.html"
|
||||
title="next chapter">is_permutation</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/libs/sprout/algorithm/equal.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" size="18" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="is_permutation.html" title="is_permutation"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="mismatch.html" title="mismatch"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout v1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Sprout C++ Libraries</a> »</li>
|
||||
<li><a href="../../libraries.html" >Libraries</a> »</li>
|
||||
<li><a href="index.html" >Sprout.Algorithm</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2013, Bolero MURAKAMI.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.4.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -67,12 +67,13 @@
|
|||
<li><a class="reference external" href="find_end.html"><em>find_end</em></a></li>
|
||||
<li><a class="reference external" href="find_first_of.html"><em>find_first_of</em></a></li>
|
||||
<li><a class="reference external" href="adjacent_find.html"><em>adjacent_find</em></a></li>
|
||||
<li><tt class="xref docutils literal"><span class="pre">count</span></tt></li>
|
||||
<li><tt class="xref docutils literal"><span class="pre">count_if</span></tt></li>
|
||||
<li><tt class="xref docutils literal"><span class="pre">mismatch</span></tt></li>
|
||||
<li><tt class="xref docutils literal"><span class="pre">equal</span></tt></li>
|
||||
<li><tt class="xref docutils literal"><span class="pre">search</span></tt></li>
|
||||
<li><tt class="xref docutils literal"><span class="pre">search_n</span></tt></li>
|
||||
<li><a class="reference external" href="count.html"><em>count</em></a></li>
|
||||
<li><a class="reference external" href="count_if.html"><em>count_if</em></a></li>
|
||||
<li><a class="reference external" href="mismatch.html"><em>mismatch</em></a></li>
|
||||
<li><a class="reference external" href="equal.html"><em>equal</em></a></li>
|
||||
<li><a class="reference external" href="is_permutation.html"><em>is_permutation</em></a></li>
|
||||
<li><a class="reference external" href="search.html"><em>search</em></a></li>
|
||||
<li><a class="reference external" href="search_n.html"><em>search_n</em></a></li>
|
||||
</ul>
|
||||
<div class="section" id="sorting">
|
||||
<h3>Sorting<a class="headerlink" href="#sorting" title="Permalink to this headline">¶</a></h3>
|
||||
|
@ -124,7 +125,6 @@
|
|||
<ul class="simple">
|
||||
<li><tt class="xref docutils literal"><span class="pre">next_permutation</span></tt></li>
|
||||
<li><tt class="xref docutils literal"><span class="pre">prev_permutation</span></tt></li>
|
||||
<li><tt class="xref docutils literal"><span class="pre">is_permutation</span></tt></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="clamp-algorithm">
|
||||
|
|
188
docs/libs/sprout/algorithm/is_permutation.html
Normal file
188
docs/libs/sprout/algorithm/is_permutation.html
Normal file
|
@ -0,0 +1,188 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>is_permutation — Sprout v1.0 documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '../../../',
|
||||
VERSION: '1.0',
|
||||
COLLAPSE_MODINDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<link rel="top" title="Sprout v1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="Sprout.Algorithm" href="index.html" />
|
||||
<link rel="next" title="search" href="search.html" />
|
||||
<link rel="prev" title="equal" href="equal.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="search.html" title="search"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="equal.html" title="equal"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout v1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Sprout C++ Libraries</a> »</li>
|
||||
<li><a href="../../libraries.html" >Libraries</a> »</li>
|
||||
<li><a href="index.html" accesskey="U">Sprout.Algorithm</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="is-permutation">
|
||||
<h1>is_permutation<a class="headerlink" href="#is-permutation" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="interface">
|
||||
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">ForwardIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">ForwardIterator2</span><span class="p">,</span> <span class="k">typename</span> <span class="n">BinaryPredicate</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">bool</span>
|
||||
<span class="n">is_permutation</span><span class="p">(</span><span class="n">ForwardIterator1</span> <span class="n">first1</span><span class="p">,</span> <span class="n">ForwardIterator1</span> <span class="n">last1</span><span class="p">,</span> <span class="n">ForwardIterator2</span> <span class="n">first2</span><span class="p">,</span> <span class="n">BinaryPredicate</span> <span class="n">pred</span><span class="p">);</span>
|
||||
|
||||
<span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">ForwardIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">ForwardIterator2</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">bool</span>
|
||||
<span class="n">is_permutation</span><span class="p">(</span><span class="n">ForwardIterator1</span> <span class="n">first1</span><span class="p">,</span> <span class="n">ForwardIterator1</span> <span class="n">last1</span><span class="p">,</span> <span class="n">ForwardIterator2</span> <span class="n">first2</span><span class="p">);</span>
|
||||
|
||||
<span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">ForwardIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">ForwardIterator2</span><span class="p">,</span> <span class="k">typename</span> <span class="n">BinaryPredicate</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">bool</span>
|
||||
<span class="n">is_permutation</span><span class="p">(</span><span class="n">ForwardIterator1</span> <span class="n">first1</span><span class="p">,</span> <span class="n">ForwardIterator1</span> <span class="n">last1</span><span class="p">,</span> <span class="n">ForwardIterator2</span> <span class="n">first2</span><span class="p">,</span> <span class="n">ForwardIterator2</span> <span class="n">last2</span><span class="p">,</span> <span class="n">BinaryPredicate</span> <span class="n">pred</span><span class="p">);</span>
|
||||
|
||||
<span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">ForwardIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">ForwardIterator2</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">bool</span>
|
||||
<span class="n">is_permutation</span><span class="p">(</span><span class="n">ForwardIterator1</span> <span class="n">first1</span><span class="p">,</span> <span class="n">ForwardIterator1</span> <span class="n">last1</span><span class="p">,</span> <span class="n">ForwardIterator2</span> <span class="n">first2</span><span class="p">,</span> <span class="n">ForwardIterator2</span> <span class="n">last2</span><span class="p">)</span> <span class="p">{</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="remarks">
|
||||
<h2>Remarks<a class="headerlink" href="#remarks" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">If last2 was not given in the argument list, it denotes <tt class="docutils literal"><span class="pre">first2</span> <span class="pre">+</span> <span class="pre">(last1</span> <span class="pre">-</span> <span class="pre">first1)</span></tt> below.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="returns">
|
||||
<h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">If <tt class="docutils literal"><span class="pre">last1</span> <span class="pre">-</span> <span class="pre">first1</span> <span class="pre">!=</span> <span class="pre">last2</span> <span class="pre">-</span> <span class="pre">first2</span></tt>, return false.</div>
|
||||
<div class="line">Otherwise return true if there exists a permutation of the elements in the range [first2,first2 + (last1 - first1)), beginning with ForwardIterator2 begin, such that <tt class="docutils literal"><span class="pre">equal(first1,</span> <span class="pre">last1,</span> <span class="pre">begin)</span></tt> returns true or <tt class="docutils literal"><span class="pre">equal(first1,</span> <span class="pre">last1,</span> <span class="pre">begin,</span> <span class="pre">pred)</span></tt> returns true; otherwise, returns false.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="examples">
|
||||
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include <sprout/algorithm/is_permutation.hpp></span>
|
||||
<span class="cp">#include <sprout/array.hpp></span>
|
||||
<span class="cp">#include <sprout/container.hpp></span>
|
||||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input1</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</span><span class="p">}};</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input2</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">10</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">}};</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">result</span> <span class="o">=</span> <span class="n">sprout</span><span class="o">::</span><span class="n">is_permutation</span><span class="p">(</span><span class="n">begin</span><span class="p">(</span><span class="n">input1</span><span class="p">),</span> <span class="n">end</span><span class="p">(</span><span class="n">input1</span><span class="p">),</span> <span class="n">begin</span><span class="p">(</span><span class="n">input2</span><span class="p">),</span> <span class="n">end</span><span class="p">(</span><span class="n">input2</span><span class="p">));</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="s">"input2 is a permutation of input1."</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="complexity">
|
||||
<h2>Complexity<a class="headerlink" href="#complexity" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">No applications of the corresponding predicate if ForwardIterator1 and ForwardIterator2 meet the requirements of random access iterators and <tt class="docutils literal"><span class="pre">last1</span> <span class="pre">-</span> <span class="pre">first1</span> <span class="pre">!=</span> <span class="pre">last2</span> <span class="pre">-</span> <span class="pre">first2</span></tt>.</div>
|
||||
<div class="line">Otherwise, exactly distance(first1, last1) applications of the corresponding predicate if <tt class="docutils literal"><span class="pre">equal(first1,</span> <span class="pre">last1,</span> <span class="pre">first2,</span> <span class="pre">last2)</span></tt> would return true if pred was not given in the argument list or <tt class="docutils literal"><span class="pre">equal(first1,</span> <span class="pre">last1,</span> <span class="pre">first2,</span> <span class="pre">last2,</span> <span class="pre">pred)</span></tt> would return true if pred was given in the argument list; otherwise, at worst O(N^2), where N has the value <tt class="docutils literal"><span class="pre">distance(first1,</span> <span class="pre">last1)</span></tt>.</div>
|
||||
<div class="line">Recursive function invocations in <em>O(logN)</em> (logarithmic) depth.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="header">
|
||||
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">sprout/algorithm/is_permutation.hpp</span></tt></div>
|
||||
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/algorithm.hpp</span></tt></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../../../index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference external" href="#">is_permutation</a><ul>
|
||||
<li><a class="reference external" href="#interface">Interface</a></li>
|
||||
<li><a class="reference external" href="#remarks">Remarks</a></li>
|
||||
<li><a class="reference external" href="#returns">Returns</a></li>
|
||||
<li><a class="reference external" href="#examples">Examples</a></li>
|
||||
<li><a class="reference external" href="#complexity">Complexity</a></li>
|
||||
<li><a class="reference external" href="#header">Header</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="equal.html"
|
||||
title="previous chapter">equal</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="search.html"
|
||||
title="next chapter">search</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/libs/sprout/algorithm/is_permutation.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" size="18" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="search.html" title="search"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="equal.html" title="equal"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout v1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Sprout C++ Libraries</a> »</li>
|
||||
<li><a href="../../libraries.html" >Libraries</a> »</li>
|
||||
<li><a href="index.html" >Sprout.Algorithm</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2013, Bolero MURAKAMI.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.4.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
195
docs/libs/sprout/algorithm/mismatch.html
Normal file
195
docs/libs/sprout/algorithm/mismatch.html
Normal file
|
@ -0,0 +1,195 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>mismatch — Sprout v1.0 documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '../../../',
|
||||
VERSION: '1.0',
|
||||
COLLAPSE_MODINDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<link rel="top" title="Sprout v1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="Sprout.Algorithm" href="index.html" />
|
||||
<link rel="next" title="equal" href="equal.html" />
|
||||
<link rel="prev" title="count_if" href="count_if.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="equal.html" title="equal"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="count_if.html" title="count_if"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout v1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Sprout C++ Libraries</a> »</li>
|
||||
<li><a href="../../libraries.html" >Libraries</a> »</li>
|
||||
<li><a href="index.html" accesskey="U">Sprout.Algorithm</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="mismatch">
|
||||
<h1>mismatch<a class="headerlink" href="#mismatch" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="interface">
|
||||
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">InputIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">InputIterator2</span><span class="p">,</span> <span class="k">typename</span> <span class="n">BinaryPredicate</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="n">sprout</span><span class="o">::</span><span class="n">pair</span><span class="o"><</span><span class="n">InputIterator1</span><span class="p">,</span> <span class="n">InputIterator2</span><span class="o">></span>
|
||||
<span class="n">mismatch</span><span class="p">(</span><span class="n">InputIterator1</span> <span class="n">first1</span><span class="p">,</span> <span class="n">InputIterator1</span> <span class="n">last1</span><span class="p">,</span> <span class="n">InputIterator2</span> <span class="n">first2</span><span class="p">,</span> <span class="n">BinaryPredicate</span> <span class="n">pred</span><span class="p">);</span>
|
||||
|
||||
<span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">InputIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">InputIterator2</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="n">sprout</span><span class="o">::</span><span class="n">pair</span><span class="o"><</span><span class="n">InputIterator1</span><span class="p">,</span> <span class="n">InputIterator2</span><span class="o">></span>
|
||||
<span class="n">mismatch</span><span class="p">(</span><span class="n">InputIterator1</span> <span class="n">first1</span><span class="p">,</span> <span class="n">InputIterator1</span> <span class="n">last1</span><span class="p">,</span> <span class="n">InputIterator2</span> <span class="n">first2</span><span class="p">;</span>
|
||||
|
||||
<span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">InputIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">InputIterator2</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="n">sprout</span><span class="o">::</span><span class="n">pair</span><span class="o"><</span><span class="n">InputIterator1</span><span class="p">,</span> <span class="n">InputIterator2</span><span class="o">></span>
|
||||
<span class="n">mismatch</span><span class="p">(</span><span class="n">InputIterator1</span> <span class="n">first1</span><span class="p">,</span> <span class="n">InputIterator1</span> <span class="n">last1</span><span class="p">,</span> <span class="n">InputIterator2</span> <span class="n">first2</span><span class="p">,</span> <span class="n">InputIterator2</span> <span class="n">last2</span><span class="p">);</span>
|
||||
|
||||
<span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">InputIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">InputIterator2</span><span class="p">,</span> <span class="k">typename</span> <span class="n">BinaryPredicate</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="n">sprout</span><span class="o">::</span><span class="n">pair</span><span class="o"><</span><span class="n">InputIterator1</span><span class="p">,</span> <span class="n">InputIterator2</span><span class="o">></span>
|
||||
<span class="n">mismatch</span><span class="p">(</span><span class="n">InputIterator1</span> <span class="n">first1</span><span class="p">,</span> <span class="n">InputIterator1</span> <span class="n">last1</span><span class="p">,</span> <span class="n">InputIterator2</span> <span class="n">first2</span><span class="p">,</span> <span class="n">InputIterator2</span> <span class="n">last2</span><span class="p">,</span> <span class="n">BinaryPredicate</span> <span class="n">pred</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="remarks">
|
||||
<h2>Remarks<a class="headerlink" href="#remarks" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">If last2 was not given in the argument list, it denotes <tt class="docutils literal"><span class="pre">first2</span> <span class="pre">+</span> <span class="pre">(last1</span> <span class="pre">-</span> <span class="pre">first1)</span></tt> below.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="returns">
|
||||
<h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">A pair of iterators i and j such that <tt class="docutils literal"><span class="pre">j</span> <span class="pre">==</span> <span class="pre">first2</span> <span class="pre">+</span> <span class="pre">(i</span> <span class="pre">-</span> <span class="pre">first1)</span></tt> and i is the first iterator in the range [first1,last1) for which the following corresponding conditions hold:</div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li>j is in the range [first2,last2).</li>
|
||||
<li><tt class="docutils literal"><span class="pre">!(*i</span> <span class="pre">==</span> <span class="pre">*(first2</span> <span class="pre">+</span> <span class="pre">(i</span> <span class="pre">-</span> <span class="pre">first1)))</span></tt></li>
|
||||
<li><tt class="docutils literal"><span class="pre">!pred(*i,</span> <span class="pre">*(first2</span> <span class="pre">+</span> <span class="pre">(i</span> <span class="pre">-</span> <span class="pre">first1)))</span></tt></li>
|
||||
</ul>
|
||||
<div class="line-block">
|
||||
<div class="line">Returns the pair <tt class="docutils literal"><span class="pre">first1</span> <span class="pre">+</span> <span class="pre">min(last1</span> <span class="pre">-</span> <span class="pre">first1,</span> <span class="pre">last2</span> <span class="pre">-</span> <span class="pre">first2)</span></tt> and <tt class="docutils literal"><span class="pre">first2</span> <span class="pre">+</span> <span class="pre">min(last1</span> <span class="pre">-</span> <span class="pre">first1,</span> <span class="pre">last2</span> <span class="pre">-</span> <span class="pre">first2)</span></tt> if such an iterator i is not found.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="examples">
|
||||
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include <sprout/algorithm/mismatch.hpp></span>
|
||||
<span class="cp">#include <sprout/array.hpp></span>
|
||||
<span class="cp">#include <sprout/container.hpp></span>
|
||||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input1</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</span><span class="p">}};</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input2</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">8</span><span class="p">}};</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">result</span> <span class="o">=</span> <span class="n">sprout</span><span class="o">::</span><span class="n">mismatch</span><span class="p">(</span><span class="n">begin</span><span class="p">(</span><span class="n">input1</span><span class="p">),</span> <span class="n">end</span><span class="p">(</span><span class="n">input1</span><span class="p">),</span> <span class="n">begin</span><span class="p">(</span><span class="n">input2</span><span class="p">),</span> <span class="n">end</span><span class="p">(</span><span class="n">input2</span><span class="p">));</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">result</span><span class="p">.</span><span class="n">first</span> <span class="o">!=</span> <span class="n">end</span><span class="p">(</span><span class="n">input1</span><span class="p">)</span> <span class="o">&&</span> <span class="n">result</span><span class="p">.</span><span class="n">second</span> <span class="o">!=</span> <span class="n">end</span><span class="p">(</span><span class="n">input2</span><span class="p">),</span> <span class="s">"input2 mismatches with input1."</span><span class="p">);</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">result</span><span class="p">.</span><span class="n">first</span> <span class="o">-</span> <span class="n">begin</span><span class="p">(</span><span class="n">input1</span><span class="p">)</span> <span class="o">==</span> <span class="mi">7</span><span class="p">,</span> <span class="s">"a mismatched position is 7."</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="complexity">
|
||||
<h2>Complexity<a class="headerlink" href="#complexity" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">At most <tt class="docutils literal"><span class="pre">last1</span> <span class="pre">-</span> <span class="pre">first1</span></tt> applications of the corresponding predicate.</div>
|
||||
<div class="line">Recursive function invocations in <em>O(logN)</em> (logarithmic) depth.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="header">
|
||||
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">sprout/algorithm/mismatch.hpp</span></tt></div>
|
||||
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/algorithm.hpp</span></tt></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../../../index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference external" href="#">mismatch</a><ul>
|
||||
<li><a class="reference external" href="#interface">Interface</a></li>
|
||||
<li><a class="reference external" href="#remarks">Remarks</a></li>
|
||||
<li><a class="reference external" href="#returns">Returns</a></li>
|
||||
<li><a class="reference external" href="#examples">Examples</a></li>
|
||||
<li><a class="reference external" href="#complexity">Complexity</a></li>
|
||||
<li><a class="reference external" href="#header">Header</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="count_if.html"
|
||||
title="previous chapter">count_if</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="equal.html"
|
||||
title="next chapter">equal</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/libs/sprout/algorithm/mismatch.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" size="18" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="equal.html" title="equal"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="count_if.html" title="count_if"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout v1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Sprout C++ Libraries</a> »</li>
|
||||
<li><a href="../../libraries.html" >Libraries</a> »</li>
|
||||
<li><a href="index.html" >Sprout.Algorithm</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2013, Bolero MURAKAMI.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.4.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
187
docs/libs/sprout/algorithm/search.html
Normal file
187
docs/libs/sprout/algorithm/search.html
Normal file
|
@ -0,0 +1,187 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>search — Sprout v1.0 documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '../../../',
|
||||
VERSION: '1.0',
|
||||
COLLAPSE_MODINDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<link rel="top" title="Sprout v1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="Sprout.Algorithm" href="index.html" />
|
||||
<link rel="next" title="search_n" href="search_n.html" />
|
||||
<link rel="prev" title="is_permutation" href="is_permutation.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="search_n.html" title="search_n"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="is_permutation.html" title="is_permutation"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout v1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Sprout C++ Libraries</a> »</li>
|
||||
<li><a href="../../libraries.html" >Libraries</a> »</li>
|
||||
<li><a href="index.html" accesskey="U">Sprout.Algorithm</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="search">
|
||||
<h1>search<a class="headerlink" href="#search" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="interface">
|
||||
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">ForwardIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">ForwardIterator2</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="n">ForwardIterator1</span>
|
||||
<span class="n">search</span><span class="p">(</span>
|
||||
<span class="n">ForwardIterator1</span> <span class="n">first1</span><span class="p">,</span> <span class="n">ForwardIterator1</span> <span class="n">last1</span><span class="p">,</span>
|
||||
<span class="n">ForwardIterator2</span> <span class="n">first2</span><span class="p">,</span> <span class="n">ForwardIterator2</span> <span class="n">last2</span>
|
||||
<span class="p">);</span>
|
||||
|
||||
<span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">ForwardIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">ForwardIterator2</span><span class="p">,</span> <span class="k">typename</span> <span class="n">BinaryPredicate</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="n">ForwardIterator1</span>
|
||||
<span class="n">search</span><span class="p">(</span>
|
||||
<span class="n">ForwardIterator1</span> <span class="n">first1</span><span class="p">,</span> <span class="n">ForwardIterator1</span> <span class="n">last1</span><span class="p">,</span>
|
||||
<span class="n">ForwardIterator2</span> <span class="n">first2</span><span class="p">,</span> <span class="n">ForwardIterator2</span> <span class="n">last2</span><span class="p">,</span>
|
||||
<span class="n">BinaryPredicate</span> <span class="n">pred</span>
|
||||
<span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="effects">
|
||||
<h2>Effects<a class="headerlink" href="#effects" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">Finds a subsequence of equal values in a sequence.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="returns">
|
||||
<h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">The first iterator i in the range [first1,last1 - (last2-first2)) such that for any nonnegative integer n less than <tt class="docutils literal"><span class="pre">last2</span> <span class="pre">-</span> <span class="pre">first2</span></tt> the following corresponding conditions hold: <tt class="docutils literal"><span class="pre">*(i</span> <span class="pre">+</span> <span class="pre">n)</span> <span class="pre">==</span> <span class="pre">*(first2</span> <span class="pre">+</span> <span class="pre">n)</span></tt>, <tt class="docutils literal"><span class="pre">pred(*(i</span> <span class="pre">+</span> <span class="pre">n),</span> <span class="pre">*(first2</span> <span class="pre">+</span> <span class="pre">n))</span></tt>.</div>
|
||||
<div class="line">Returns first1 if [first2,last2) is empty, otherwise returns last1 if no such iterator is found.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="examples">
|
||||
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include <sprout/algorithm/search.hpp></span>
|
||||
<span class="cp">#include <sprout/array.hpp></span>
|
||||
<span class="cp">#include <sprout/container.hpp></span>
|
||||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input1</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">}};</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input2</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">3</span><span class="o">></span><span class="p">{{</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">}};</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">result</span> <span class="o">=</span> <span class="n">sprout</span><span class="o">::</span><span class="n">search</span><span class="p">(</span><span class="n">begin</span><span class="p">(</span><span class="n">input1</span><span class="p">),</span> <span class="n">end</span><span class="p">(</span><span class="n">input1</span><span class="p">),</span> <span class="n">begin</span><span class="p">(</span><span class="n">input2</span><span class="p">),</span> <span class="n">end</span><span class="p">(</span><span class="n">input2</span><span class="p">));</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">result</span> <span class="o">!=</span> <span class="n">end</span><span class="p">(</span><span class="n">input1</span><span class="p">),</span> <span class="s">"found a subsequence equal to input2 from input1."</span><span class="p">);</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">result</span> <span class="o">-</span> <span class="n">begin</span><span class="p">(</span><span class="n">input1</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">,</span> <span class="s">"a found position is 2."</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="complexity">
|
||||
<h2>Complexity<a class="headerlink" href="#complexity" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">At most <tt class="docutils literal"><span class="pre">(last1</span> <span class="pre">-</span> <span class="pre">first1)</span> <span class="pre">*</span> <span class="pre">(last2</span> <span class="pre">-</span> <span class="pre">first2)</span></tt> applications of the corresponding predicate.</div>
|
||||
<div class="line">Recursive function invocations in <em>O(logN)</em> (logarithmic) depth.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="header">
|
||||
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">sprout/algorithm/search.hpp</span></tt></div>
|
||||
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/algorithm.hpp</span></tt></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../../../index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference external" href="#">search</a><ul>
|
||||
<li><a class="reference external" href="#interface">Interface</a></li>
|
||||
<li><a class="reference external" href="#effects">Effects</a></li>
|
||||
<li><a class="reference external" href="#returns">Returns</a></li>
|
||||
<li><a class="reference external" href="#examples">Examples</a></li>
|
||||
<li><a class="reference external" href="#complexity">Complexity</a></li>
|
||||
<li><a class="reference external" href="#header">Header</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="is_permutation.html"
|
||||
title="previous chapter">is_permutation</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="search_n.html"
|
||||
title="next chapter">search_n</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/libs/sprout/algorithm/search.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" size="18" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="search_n.html" title="search_n"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="is_permutation.html" title="is_permutation"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout v1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Sprout C++ Libraries</a> »</li>
|
||||
<li><a href="../../libraries.html" >Libraries</a> »</li>
|
||||
<li><a href="index.html" >Sprout.Algorithm</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2013, Bolero MURAKAMI.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.4.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
176
docs/libs/sprout/algorithm/search_n.html
Normal file
176
docs/libs/sprout/algorithm/search_n.html
Normal file
|
@ -0,0 +1,176 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>search_n — Sprout v1.0 documentation</title>
|
||||
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '../../../',
|
||||
VERSION: '1.0',
|
||||
COLLAPSE_MODINDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||||
<link rel="top" title="Sprout v1.0 documentation" href="../../../index.html" />
|
||||
<link rel="up" title="Sprout.Algorithm" href="index.html" />
|
||||
<link rel="prev" title="search" href="search.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="search.html" title="search"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout v1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Sprout C++ Libraries</a> »</li>
|
||||
<li><a href="../../libraries.html" >Libraries</a> »</li>
|
||||
<li><a href="index.html" accesskey="U">Sprout.Algorithm</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="search-n">
|
||||
<h1>search_n<a class="headerlink" href="#search-n" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="interface">
|
||||
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">ForwardIterator</span><span class="p">,</span> <span class="k">typename</span> <span class="n">Size</span><span class="p">,</span> <span class="k">typename</span> <span class="n">T</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="n">ForwardIterator</span>
|
||||
<span class="n">search_n</span><span class="p">(</span><span class="n">ForwardIterator</span> <span class="n">first</span><span class="p">,</span> <span class="n">ForwardIterator</span> <span class="n">last</span><span class="p">,</span> <span class="n">Size</span> <span class="n">count</span><span class="p">,</span> <span class="n">T</span> <span class="k">const</span><span class="o">&</span> <span class="n">value</span><span class="p">);</span>
|
||||
|
||||
<span class="k">template</span><span class="o"><</span><span class="k">typename</span> <span class="n">ForwardIterator</span><span class="p">,</span> <span class="k">typename</span> <span class="n">Size</span><span class="p">,</span> <span class="k">typename</span> <span class="n">T</span><span class="p">,</span> <span class="k">typename</span> <span class="n">BinaryPredicate</span><span class="o">></span>
|
||||
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="n">ForwardIterator</span>
|
||||
<span class="n">search_n</span><span class="p">(</span><span class="n">ForwardIterator</span> <span class="n">first</span><span class="p">,</span> <span class="n">ForwardIterator</span> <span class="n">last</span><span class="p">,</span> <span class="n">Size</span> <span class="n">count</span><span class="p">,</span> <span class="n">T</span> <span class="k">const</span><span class="o">&</span> <span class="n">value</span><span class="p">,</span> <span class="n">BinaryPredicate</span> <span class="n">pred</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="requires">
|
||||
<h2>Requires<a class="headerlink" href="#requires" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">The type Size shall be convertible to integral type.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="effects">
|
||||
<h2>Effects<a class="headerlink" href="#effects" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">Finds a subsequence of equal values in a sequence.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="returns">
|
||||
<h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">The first iterator i in the range [first,last-count) such that for any non-negative integer n less than count the following corresponding conditions hold: <tt class="docutils literal"><span class="pre">*(i</span> <span class="pre">+</span> <span class="pre">n)</span> <span class="pre">==</span> <span class="pre">value</span></tt>, <tt class="docutils literal"><span class="pre">pred(*(i</span> <span class="pre">+</span> <span class="pre">n),value)</span></tt>.</div>
|
||||
<div class="line">Returns last if no such iterator is found.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="examples">
|
||||
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include <sprout/algorithm/search_n.hpp></span>
|
||||
<span class="cp">#include <sprout/array.hpp></span>
|
||||
<span class="cp">#include <sprout/container.hpp></span>
|
||||
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
|
||||
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input1</span> <span class="o">=</span> <span class="n">array</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">></span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</span><span class="p">}};</span>
|
||||
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">result</span> <span class="o">=</span> <span class="n">sprout</span><span class="o">::</span><span class="n">search_n</span><span class="p">(</span><span class="n">begin</span><span class="p">(</span><span class="n">input1</span><span class="p">),</span> <span class="n">end</span><span class="p">(</span><span class="n">input1</span><span class="p">),</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">);</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">result</span> <span class="o">!=</span> <span class="n">end</span><span class="p">(</span><span class="n">input1</span><span class="p">),</span> <span class="s">"found a subsequence equal to 4 values of 5 from input1."</span><span class="p">);</span>
|
||||
<span class="n">static_assert</span><span class="p">(</span><span class="n">result</span> <span class="o">-</span> <span class="n">begin</span><span class="p">(</span><span class="n">input1</span><span class="p">)</span> <span class="o">==</span> <span class="mi">3</span><span class="p">,</span> <span class="s">"a found position is 3."</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="complexity">
|
||||
<h2>Complexity<a class="headerlink" href="#complexity" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line">At most <tt class="docutils literal"><span class="pre">last</span> <span class="pre">-</span> <span class="pre">first</span></tt> applications of the corresponding predicate.</div>
|
||||
<div class="line">Recursive function invocations in <em>O(logN)</em> (logarithmic) depth.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="header">
|
||||
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="line-block">
|
||||
<div class="line"><tt class="docutils literal"><span class="pre">sprout/algorithm/search_n.hpp</span></tt></div>
|
||||
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/algorithm.hpp</span></tt></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="../../../index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference external" href="#">search_n</a><ul>
|
||||
<li><a class="reference external" href="#interface">Interface</a></li>
|
||||
<li><a class="reference external" href="#requires">Requires</a></li>
|
||||
<li><a class="reference external" href="#effects">Effects</a></li>
|
||||
<li><a class="reference external" href="#returns">Returns</a></li>
|
||||
<li><a class="reference external" href="#examples">Examples</a></li>
|
||||
<li><a class="reference external" href="#complexity">Complexity</a></li>
|
||||
<li><a class="reference external" href="#header">Header</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="search.html"
|
||||
title="previous chapter">search</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../../../_sources/libs/sprout/algorithm/search_n.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="../../../search.html" method="get">
|
||||
<input type="text" name="q" size="18" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="../../../genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="search.html" title="search"
|
||||
>previous</a> |</li>
|
||||
<li><a href="../../../index.html">Sprout v1.0 documentation</a> »</li>
|
||||
<li><a href="../../index.html" >Sprout C++ Libraries</a> »</li>
|
||||
<li><a href="../../libraries.html" >Libraries</a> »</li>
|
||||
<li><a href="index.html" >Sprout.Algorithm</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2013, Bolero MURAKAMI.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.4.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because one or more lines are too long
43
source/libs/sprout/algorithm/count.rst
Normal file
43
source/libs/sprout/algorithm/count.rst
Normal file
|
@ -0,0 +1,43 @@
|
|||
.. _sprout-algorithm-count:
|
||||
###############################################################################
|
||||
count
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename InputIterator, typename T>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
count(InputIterator first, InputIterator last, T const& value);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| The number of iterators i in the range [first,last) for which the following corresponding conditions hold: ``*i == value``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/count.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 5, 5, 5, 5, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::count(begin(input), end(input), 5);
|
||||
static_assert(result == 4, "counted 4 elements equal to 5 from input.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Exactly ``last - first`` applications of the predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/count.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
44
source/libs/sprout/algorithm/count_if.rst
Normal file
44
source/libs/sprout/algorithm/count_if.rst
Normal file
|
@ -0,0 +1,44 @@
|
|||
.. _sprout-algorithm-count_if:
|
||||
###############################################################################
|
||||
count_if
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename InputIterator, typename Predicate>
|
||||
inline SPROUT_CONSTEXPR typename std::iterator_traits<InputIterator>::difference_type
|
||||
count_if(InputIterator first, InputIterator last, Predicate pred);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| The number of iterators i in the range [first,last) for which the following corresponding conditions hold: ``pred(*i)``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/count_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::count_if(begin(input), end(input), bind2nd(modulus<>(), 2));
|
||||
static_assert(result == 5, "counted 5 elements of odd number from input.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Exactly ``last - first`` applications of the predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/count_if.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
64
source/libs/sprout/algorithm/equal.rst
Normal file
64
source/libs/sprout/algorithm/equal.rst
Normal file
|
@ -0,0 +1,64 @@
|
|||
.. _sprout-algorithm-equal:
|
||||
###############################################################################
|
||||
equal
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate pred);
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred);
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
|
||||
|
||||
Remarks
|
||||
========================================
|
||||
|
||||
| If last2 was not given in the argument list, it denotes ``first2 + (last1 - first1)`` below.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| If ``last1 - first1 != last2 - first2``, return false.
|
||||
| Otherwise return true if for every iterator i in the range [first1,last1) the following corresponding conditions hold: ``*i == *(first2 + (i - first1))``, ``pred(*i, *(first2 + (i - first1)))``.
|
||||
| Otherwise, returns false.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/equal.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input1 = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto input2 = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::equal(begin(input1), end(input1), begin(input2), end(input2));
|
||||
static_assert(result, "input2 equals to input1.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| No applications of the corresponding predicate if InputIterator1 and InputIterator2 meet the requirements of random access iterators and ``last1 - first1 != last2 - first2``.
|
||||
| Otherwise, at most ``min(last1 - first1, last2 - first2)`` applications of the corresponding predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/equal.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
|
@ -20,6 +20,13 @@ Sprout.Algorithm
|
|||
find_end
|
||||
find_first_of
|
||||
adjacent_find
|
||||
count
|
||||
count_if
|
||||
mismatch
|
||||
equal
|
||||
is_permutation
|
||||
search
|
||||
search_n
|
||||
|
||||
.. _sprout-algorithm-non_modifying:
|
||||
*******************************************************************************
|
||||
|
@ -44,6 +51,7 @@ Non-modifying sequence operations
|
|||
* :doc:`count_if <./count_if>`
|
||||
* :doc:`mismatch <./mismatch>`
|
||||
* :doc:`equal <./equal>`
|
||||
* :doc:`is_permutation <./is_permutation>`
|
||||
* :doc:`search <./search>`
|
||||
* :doc:`search_n <./search_n>`
|
||||
|
||||
|
@ -98,7 +106,6 @@ Permutation generators
|
|||
|
||||
* :doc:`next_permutation <./next_permutation>`
|
||||
* :doc:`prev_permutation <./prev_permutation>`
|
||||
* :doc:`is_permutation <./is_permutation>`
|
||||
|
||||
.. _sprout-algorithm-non_modifying-clamp:
|
||||
Clamp algorithm
|
||||
|
|
63
source/libs/sprout/algorithm/is_permutation.rst
Normal file
63
source/libs/sprout/algorithm/is_permutation.rst
Normal file
|
@ -0,0 +1,63 @@
|
|||
.. _sprout-algorithm-is_permutation:
|
||||
###############################################################################
|
||||
is_permutation
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename ForwardIterator1, typename ForwardIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, BinaryPredicate pred);
|
||||
|
||||
template<typename ForwardIterator1, typename ForwardIterator2>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
|
||||
|
||||
template<typename ForwardIterator1, typename ForwardIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
|
||||
|
||||
template<typename ForwardIterator1, typename ForwardIterator2>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_permutation(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2) {
|
||||
|
||||
Remarks
|
||||
========================================
|
||||
|
||||
| If last2 was not given in the argument list, it denotes ``first2 + (last1 - first1)`` below.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| If ``last1 - first1 != last2 - first2``, return false.
|
||||
| Otherwise return true if there exists a permutation of the elements in the range [first2,first2 + (last1 - first1)), beginning with ForwardIterator2 begin, such that ``equal(first1, last1, begin)`` returns true or ``equal(first1, last1, begin, pred)`` returns true; otherwise, returns false.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/is_permutation.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input1 = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto input2 = array<int, 10>{{10, 9, 8, 1, 2, 3, 4, 5, 6, 7}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::is_permutation(begin(input1), end(input1), begin(input2), end(input2));
|
||||
static_assert(result, "input2 is a permutation of input1.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| No applications of the corresponding predicate if ForwardIterator1 and ForwardIterator2 meet the requirements of random access iterators and ``last1 - first1 != last2 - first2``.
|
||||
| Otherwise, exactly distance(first1, last1) applications of the corresponding predicate if ``equal(first1, last1, first2, last2)`` would return true if pred was not given in the argument list or ``equal(first1, last1, first2, last2, pred)`` would return true if pred was given in the argument list; otherwise, at worst O(N^2), where N has the value ``distance(first1, last1)``.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/is_permutation.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
66
source/libs/sprout/algorithm/mismatch.rst
Normal file
66
source/libs/sprout/algorithm/mismatch.rst
Normal file
|
@ -0,0 +1,66 @@
|
|||
.. _sprout-algorithm-mismatch:
|
||||
###############################################################################
|
||||
mismatch
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<InputIterator1, InputIterator2>
|
||||
mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate pred);
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<InputIterator1, InputIterator2>
|
||||
mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2;
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<InputIterator1, InputIterator2>
|
||||
mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
|
||||
|
||||
template<typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR sprout::pair<InputIterator1, InputIterator2>
|
||||
mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred);
|
||||
|
||||
Remarks
|
||||
========================================
|
||||
|
||||
| If last2 was not given in the argument list, it denotes ``first2 + (last1 - first1)`` below.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| A pair of iterators i and j such that ``j == first2 + (i - first1)`` and i is the first iterator in the range [first1,last1) for which the following corresponding conditions hold:
|
||||
* j is in the range [first2,last2).
|
||||
* ``!(*i == *(first2 + (i - first1)))``
|
||||
* ``!pred(*i, *(first2 + (i - first1)))``
|
||||
| Returns the pair ``first1 + min(last1 - first1, last2 - first2)`` and ``first2 + min(last1 - first1, last2 - first2)`` if such an iterator i is not found.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/mismatch.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input1 = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto input2 = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 10, 9, 8}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::mismatch(begin(input1), end(input1), begin(input2), end(input2));
|
||||
static_assert(result.first != end(input1) && result.second != end(input2), "input2 mismatches with input1.");
|
||||
static_assert(result.first - begin(input1) == 7, "a mismatched position is 7.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| At most ``last1 - first1`` applications of the corresponding predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/mismatch.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
62
source/libs/sprout/algorithm/search.rst
Normal file
62
source/libs/sprout/algorithm/search.rst
Normal file
|
@ -0,0 +1,62 @@
|
|||
.. _sprout-algorithm-search:
|
||||
###############################################################################
|
||||
search
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename ForwardIterator1, typename ForwardIterator2>
|
||||
inline SPROUT_CONSTEXPR ForwardIterator1
|
||||
search(
|
||||
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
|
||||
);
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| Finds a subsequence of equal values in a sequence.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| The first iterator i in the range [first1,last1 - (last2-first2)) such that for any nonnegative integer n less than ``last2 - first2`` the following corresponding conditions hold: ``*(i + n) == *(first2 + n)``, ``pred(*(i + n), *(first2 + n))``.
|
||||
| Returns first1 if [first2,last2) is empty, otherwise returns last1 if no such iterator is found.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/search.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input1 = array<int, 10>{{1, 2, 3, 4, 5, 1, 2, 3, 4, 5}};
|
||||
SPROUT_STATIC_CONSTEXPR auto input2 = array<int, 3>{{3, 4, 5}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::search(begin(input1), end(input1), begin(input2), end(input2));
|
||||
static_assert(result != end(input1), "found a subsequence equal to input2 from input1.");
|
||||
static_assert(result - begin(input1) == 2, "a found position is 2.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| At most ``(last1 - first1) * (last2 - first2)`` applications of the corresponding predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/search.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
59
source/libs/sprout/algorithm/search_n.rst
Normal file
59
source/libs/sprout/algorithm/search_n.rst
Normal file
|
@ -0,0 +1,59 @@
|
|||
.. _sprout-algorithm-search_n:
|
||||
###############################################################################
|
||||
search_n
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename ForwardIterator, typename Size, typename T>
|
||||
inline SPROUT_CONSTEXPR ForwardIterator
|
||||
search_n(ForwardIterator first, ForwardIterator last, Size count, T const& value);
|
||||
|
||||
template<typename ForwardIterator, typename Size, typename T, typename BinaryPredicate>
|
||||
inline SPROUT_CONSTEXPR ForwardIterator
|
||||
search_n(ForwardIterator first, ForwardIterator last, Size count, T const& value, BinaryPredicate pred);
|
||||
|
||||
Requires
|
||||
========================================
|
||||
|
||||
| The type Size shall be convertible to integral type.
|
||||
|
||||
Effects
|
||||
========================================
|
||||
|
||||
| Finds a subsequence of equal values in a sequence.
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| The first iterator i in the range [first,last-count) such that for any non-negative integer n less than count the following corresponding conditions hold: ``*(i + n) == value``, ``pred(*(i + n),value)``.
|
||||
| Returns last if no such iterator is found.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/search_n.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input1 = array<int, 10>{{1, 2, 3, 5, 5, 5, 5, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::search_n(begin(input1), end(input1), 4, 5);
|
||||
static_assert(result != end(input1), "found a subsequence equal to 4 values of 5 from input1.");
|
||||
static_assert(result - begin(input1) == 3, "a found position is 3.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| At most ``last - first`` applications of the corresponding predicate.
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/search_n.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
Loading…
Add table
Reference in a new issue