mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-04 14:14:09 +00:00
add doc: is_increasing, is_decreasing
This commit is contained in:
parent
15397fdd71
commit
958e2cb7a4
17 changed files with 1012 additions and 8 deletions
|
@ -29,6 +29,10 @@ Sprout.Algorithm
|
|||
search_n
|
||||
is_sorted
|
||||
is_sorted_until
|
||||
is_increasing
|
||||
is_decreasing
|
||||
is_strictly_increasing
|
||||
is_strictly_decreasing
|
||||
|
||||
.. _sprout-algorithm-non_modifying:
|
||||
*******************************************************************************
|
||||
|
@ -81,8 +85,8 @@ Binary search
|
|||
Heap operations
|
||||
========================================
|
||||
|
||||
* :doc:`is_heap_until <./is_heap_until>`
|
||||
* :doc:`is_heap <./is_heap>`
|
||||
* :doc:`is_heap_until <./is_heap_until>`
|
||||
|
||||
.. _sprout-algorithm-non_modifying-minmax:
|
||||
Minimum and maximum
|
||||
|
|
42
source/libs/sprout/algorithm/is_decreasing.rst
Normal file
42
source/libs/sprout/algorithm/is_decreasing.rst
Normal file
|
@ -0,0 +1,42 @@
|
|||
.. _sprout-algorithm-is_decreasing:
|
||||
###############################################################################
|
||||
is_decreasing
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename ForwardIterator>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_decreasing(ForwardIterator first, ForwardIterator last);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| Same as ``is_sorted(first, last, greater<>())``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/is_decreasing.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{5, 5, 4, 4, 3, 3, 2, 2, 1, 1}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::is_decreasing(begin(input), end(input));
|
||||
static_assert(result, "input is decreasing.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/is_decreasing.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
42
source/libs/sprout/algorithm/is_increasing.rst
Normal file
42
source/libs/sprout/algorithm/is_increasing.rst
Normal file
|
@ -0,0 +1,42 @@
|
|||
.. _sprout-algorithm-is_increasing:
|
||||
###############################################################################
|
||||
is_increasing
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename ForwardIterator>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_increasing(ForwardIterator first, ForwardIterator last);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| Same as ``is_sorted(first, last, less<>())``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/is_increasing.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 1, 2, 2, 3, 3, 4, 4, 5, 5}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::is_increasing(begin(input), end(input));
|
||||
static_assert(result, "input is increasing.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/is_increasing.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
42
source/libs/sprout/algorithm/is_strictly_decreasing.rst
Normal file
42
source/libs/sprout/algorithm/is_strictly_decreasing.rst
Normal file
|
@ -0,0 +1,42 @@
|
|||
.. _sprout-algorithm-is_strictly_decreasing:
|
||||
###############################################################################
|
||||
is_strictly_decreasing
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename ForwardIterator>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_strictly_decreasing(ForwardIterator first, ForwardIterator last);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| Same as ``is_sorted(first, last, greater_equal<>())``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/is_strictly_decreasing.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{10, 9, 8, 7, 6, 5, 4, 3, 2, 1}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::is_strictly_decreasing(begin(input), end(input));
|
||||
static_assert(result, "input is strictly decreasing.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/is_strictly_decreasing.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
42
source/libs/sprout/algorithm/is_strictly_increasing.rst
Normal file
42
source/libs/sprout/algorithm/is_strictly_increasing.rst
Normal file
|
@ -0,0 +1,42 @@
|
|||
.. _sprout-algorithm-is_strictly_increasing:
|
||||
###############################################################################
|
||||
is_strictly_increasing
|
||||
###############################################################################
|
||||
|
||||
Interface
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
template<typename ForwardIterator>
|
||||
inline SPROUT_CONSTEXPR bool
|
||||
is_strictly_increasing(ForwardIterator first, ForwardIterator last);
|
||||
|
||||
Returns
|
||||
========================================
|
||||
|
||||
| Same as ``is_sorted(first, last, less_equal<>())``.
|
||||
|
||||
Examples
|
||||
========================================
|
||||
.. sourcecode:: c++
|
||||
|
||||
#include <sprout/algorithm/is_strictly_increasing.hpp>
|
||||
#include <sprout/array.hpp>
|
||||
#include <sprout/container.hpp>
|
||||
using namespace sprout;
|
||||
|
||||
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto result = sprout::is_strictly_increasing(begin(input), end(input));
|
||||
static_assert(result, "input is strictly increasing.");
|
||||
|
||||
Complexity
|
||||
========================================
|
||||
|
||||
| Recursive function invocations in *O(logN)* (logarithmic) depth.
|
||||
|
||||
Header
|
||||
========================================
|
||||
|
||||
| ``sprout/algorithm/is_strictly_increasing.hpp``
|
||||
| Convenience header: ``sprout/algorithm.hpp``
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue