|
rah
|
#include <cassert>#include <ciso646>#include <type_traits>#include <iterator>#include <tuple>#include <algorithm>#include <numeric>#include <vector>#include <array>Go to the source code of this file.
Namespaces | |
| rah | |
| rah::details | |
| rah::view | |
| rah::action | |
Macros | |
| #define | RAH_STD std |
| #define | RAH_NAMESPACE rah |
Functions | |
| template<class T , size_t N> | |
| T * | rah::begin (T(&array)[N]) |
| template<class T , size_t N> | |
| T * | rah::end (T(&array)[N]) noexcept |
| template<typename T > | |
| T & | rah::fake () |
| Used in decltype to get an instance of a type. More... | |
| template<typename I > | |
| auto | rah::make_iterator_range (I b, I e) |
| Create a rah::iterator_range with two given iterators. More... | |
| template<typename I > | |
| I | rah::begin (iterator_range< I > &r) |
| Get the begin iterator of the range. More... | |
| template<typename I > | |
| I | rah::end (iterator_range< I > &r) |
| Get the "past the" end iterator of the range. More... | |
| template<typename I > | |
| I | rah::begin (iterator_range< I > const &r) |
| Get the begin iterator of the range. More... | |
| template<typename I > | |
| I | rah::end (iterator_range< I > const &r) |
| Get the "past the" end iterator of the range. More... | |
| template<typename MakeRange > | |
| auto | rah::make_pipeable (MakeRange &&make_range) |
| Call to create a "pipeable" function (UFCS style in c++) More... | |
| template<typename R , typename MakeRange > | |
| auto | rah::operator| (R &&range, pipeable< MakeRange > const &adapter) -> decltype(adapter.func(std ::forward< R >(range))) |
| template<typename C > | |
| auto | rah::back_inserter (C &&container) |
| Make a range which insert into the back of the a container. More... | |
| template<typename R > | |
| auto | rah::view::all (R &&range) |
| Create a view on the whole range. More... | |
| auto | rah::view::all () |
| Create a view on the whole range. More... | |
| template<typename R > | |
| auto | rah::view::take (R &&range, size_t count) |
| Given a source range and an integral count, return a range consisting of the first count elements from the source range, or the complete range if it has fewer elements. More... | |
| auto | rah::view::take (size_t count) |
| Given a source range and an integral count, return a range consisting of the first count elements from the source range, or the complete range if it has fewer elements. More... | |
| template<typename R > | |
| auto | rah::view::sliding (R &&range, size_t n) |
| Given a range and a count n, place a window over the first n elements of the underlying range. More... | |
| auto | rah::view::sliding (size_t n) |
| Given a range and a count n, place a window over the first n elements of the underlying range. More... | |
| template<typename R > | |
| auto | rah::view::drop_exactly (R &&range, size_t count) |
| Given a source range and an integral count, return a range consisting of all but the first count elements from the source range. More... | |
| auto | rah::view::drop_exactly (size_t count) |
| Given a source range and an integral count, return a range consisting of all but the first count elements from the source range. More... | |
| template<typename R > | |
| auto | rah::view::drop (R &&range, size_t count) |
| Given a source range and an integral count, return a range consisting of all but the first count elements from the source range, or an empty range if it has fewer elements. More... | |
| auto | rah::view::drop (size_t count) |
| Given a source range and an integral count, return a range consisting of all but the first count elements from the source range, or an empty range if it has fewer elements. More... | |
| template<typename I > | |
| auto | rah::view::counted (I &&it, size_t n, decltype(++it, 0)=0) |
| Given an iterator it and a count n, create a range that starts at it and includes the next n elements. More... | |
| template<typename I > | |
| auto | rah::view::unbounded (I &&it) |
| Given an iterator, return an infinite range that begins at that position. More... | |
| template<typename T = size_t> | |
| auto | rah::view::ints (T b=0, T e=std ::numeric_limits< T >::max()) |
| Generate a range of monotonically increasing ints. More... | |
| template<typename T = size_t> | |
| auto | rah::view::closed_ints (T b=0, T e=std ::numeric_limits< T >::max() - 1) |
| Generate a range of monotonically increasing ints. More... | |
| template<typename T = size_t> | |
| auto | rah::view::iota (T b, T e, T step=1) |
| Generate a range of sequential integers, increasing by a defined step. More... | |
| template<typename V > | |
| auto | rah::view::repeat (V &&value) |
| Generate an infinite range of the given value. More... | |
| template<typename R > | |
| auto | rah::view::join (R &&range_of_ranges) |
| Given a range of ranges, join them into a flattened sequence of elements. More... | |
| auto | rah::view::join () |
| Given a range of ranges, join them into a flattened sequence of elements. More... | |
| template<typename R > | |
| auto | rah::view::cycle (R &&range) |
| Returns an infinite range that endlessly repeats the source range. More... | |
| auto | rah::view::cycle () |
| Returns an infinite range that endlessly repeats the source range. More... | |
| template<typename F > | |
| auto | rah::view::generate (F &&func) |
| Create an infinite range, repetitively calling func. More... | |
| template<typename F > | |
| auto | rah::view::generate_n (size_t count, F &&func) |
| template<typename R , typename F > | |
| auto | rah::view::transform (R &&range, F &&func) |
| Create a view applying a transformation to each element of the input range. More... | |
| template<typename F > | |
| auto | rah::view::transform (F &&func) |
| Create a view applying a transformation to each element of the input range. More... | |
| template<typename R1 , typename R2 > | |
| auto | rah::view::set_difference (R1 &&range1, R2 &&range2) |
| template<typename R2 > | |
| auto | rah::view::set_difference (R2 &&range2) |
| template<typename R , typename F > | |
| auto | rah::view::for_each (R &&range, F &&func) |
| Lazily applies an unary function to each element in the source range that returns another range (possibly empty), flattening the result. More... | |
| template<typename F > | |
| auto | rah::view::for_each (F &&func) |
| Lazily applies an unary function to each element in the source range that returns another range (possibly empty), flattening the result. More... | |
| template<typename R > | |
| auto | rah::view::slice (R &&range, intptr_t begin_idx, intptr_t end_idx) |
| Create a view that is a sub-range of a range. More... | |
| auto | rah::view::slice (intptr_t begin, intptr_t end) |
| Create a view that is a sub-range of a range. More... | |
| template<typename R > | |
| auto | rah::view::stride (R &&range, size_t step) |
| Create a view consisting of every Nth element, starting with the first. More... | |
| auto | rah::view::stride (size_t step) |
| Create a view consisting of every Nth element, starting with the first. More... | |
| template<typename R > | |
| auto | rah::view::retro (R &&range) |
| Create a view that traverses the source range in reverse order. More... | |
| auto | rah::view::retro () |
| Create a view that traverses the source range in reverse order. More... | |
| template<typename V > | |
| auto | rah::view::single (V &&value) |
| Given value, create a view containing one element. More... | |
| template<typename ... R> | |
| auto | rah::view::zip (R &&... _ranges) |
| Given N ranges, return a new range where Mth element is the result of calling std::make_tuple on the Mth elements of all N ranges. More... | |
| template<typename R > | |
| auto | rah::view::chunk (R &&range, size_t step) |
| Create a view where each element is a range of N elements of the input range. More... | |
| auto | rah::view::chunk (size_t step) |
| Create a view where each element is a range of N elements of the input range. More... | |
| template<typename R , typename F > | |
| auto | rah::view::filter (R &&range, F &&func) |
| Create a view with only elements which are filtered. More... | |
| template<typename F > | |
| auto | rah::view::filter (F &&func) |
| Create a view with only elements which are filtered. More... | |
| template<typename R1 > | |
| auto | rah::view::concat (R1 &&range1) |
| return the same range More... | |
| template<typename R1 , typename R2 > | |
| auto | rah::view::concat (R1 &&range1, R2 &&range2) |
| Create a view that is the concatenation of 2 ranges. More... | |
| template<typename R1 , typename R2 , typename ... Ranges> | |
| auto | rah::view::concat (R1 &&range1, R2 &&range2, Ranges &&... ranges) |
| template<typename R > | |
| auto | rah::view::enumerate (R &&range) |
| Pair each element of a range with its index. More... | |
| auto | rah::view::enumerate () |
| Pair each element of a range with its index. More... | |
| template<typename R > | |
| auto | rah::view::map_value (R &&range) |
| Given a range of std::pair-std::tuple, create a view consisting of just the first element of the pair. More... | |
| auto | rah::view::map_value () |
| Given a range of std::pair-std::tuple, create a view consisting of just the first element of the pair. More... | |
| template<typename R > | |
| auto | rah::view::map_key (R &&range) |
| Given a range of std::pair-std::tuple, create a view consisting of just the second element of the pair. More... | |
| auto | rah::view::map_key () |
| Given a range of std::pair-std::tuple, create a view consisting of just the second element of the pair. More... | |
| template<typename R , typename P = is_lesser, typename = std ::enable_if_t<is_range<R>::value>> | |
| auto | rah::view::sort (R &&range, P &&pred={}) |
| Make a sorted view of a range. More... | |
| template<typename P = is_lesser, typename = std ::enable_if_t<not is_range<P>::value>> | |
| auto | rah::view::sort (P &&pred={}) |
| Make a sorted view of a range. More... | |
| template<typename R > | |
| bool | rah::empty (R &&range) |
| Check if the range if empty. More... | |
| auto | rah::empty () |
| Check if the range if empty. More... | |
| template<typename R , typename V > | |
| auto | rah::equal_range (R &&range, V &&value, std ::enable_if_t< is_range< R >::value, int >=0) |
| Returns a range containing all elements equivalent to value in the range. More... | |
| template<typename V > | |
| auto | rah::equal_range (V &&value) |
| Returns a range containing all elements equivalent to value in the range. More... | |
| template<typename R , typename V , typename P > | |
| auto | rah::equal_range (R &&range, V &&value, P &&pred) |
| Returns a range containing all elements equivalent to value in the range. More... | |
| template<typename V , typename P > | |
| auto | rah::equal_range (V &&value, P &&pred, std ::enable_if_t<!is_range< V >::value, int >=0) |
| Returns a range containing all elements equivalent to value in the range. More... | |
| template<typename R , typename V > | |
| auto | rah::binary_search (R &&range, V &&value) |
| Checks if an element equivalent to value appears within the range. More... | |
| template<typename V > | |
| auto | rah::binary_search (V &&value) |
| Checks if an element equivalent to value appears within the range. More... | |
| template<typename RI , typename RO , typename F > | |
| auto | rah::transform (RI &&rangeIn, RO &&rangeOut, F &&unary_op) |
| Applies the given function unary_op to the range rangeIn and stores the result in the range rangeOut. More... | |
| template<typename RI1 , typename RI2 , typename RO , typename F > | |
| auto | rah::transform (RI1 &&rangeIn1, RI2 &&rangeIn2, RO &&rangeOut, F &&binary_op) |
| The binary operation binary_op is applied to pairs of elements from two ranges. More... | |
| template<typename R , typename I , typename F > | |
| auto | rah::reduce (R &&range, I &&init, F &&reducer) |
| Executes a reducer function on each element of the range, resulting in a single output value. More... | |
| template<typename I , typename F > | |
| auto | rah::reduce (I &&init, F &&reducer) |
| Executes a reducer function on each element of the range, resulting in a single output value. More... | |
| template<typename R , typename F > | |
| bool | rah::any_of (R &&range, F &&pred) |
| Checks if unary predicate pred returns true for at least one element in the range. More... | |
| template<typename P > | |
| auto | rah::any_of (P &&pred) |
| Checks if unary predicate pred returns true for at least one element in the range. More... | |
| template<typename R , typename P > | |
| bool | rah::all_of (R &&range, P &&pred) |
| Checks if unary predicate pred returns true for all elements in the range. More... | |
| template<typename P > | |
| auto | rah::all_of (P &&pred) |
| Checks if unary predicate pred returns true for all elements in the range. More... | |
| template<typename R , typename P > | |
| bool | rah::none_of (R &&range, P &&pred) |
| Checks if unary predicate pred returns true for no elements in the range. More... | |
| template<typename P > | |
| auto | rah::none_of (P &&pred) |
| Checks if unary predicate pred returns true for no elements in the range. More... | |
| template<typename R , typename V > | |
| auto | rah::count (R &&range, V &&value) |
| Counts the elements that are equal to value. More... | |
| template<typename V > | |
| auto | rah::count (V &&value) |
| Counts the elements that are equal to value. More... | |
| template<typename R , typename P > | |
| auto | rah::count_if (R &&range, P &&pred) |
| Counts elements for which predicate pred returns true. More... | |
| template<typename P > | |
| auto | rah::count_if (P &&pred) |
| Counts elements for which predicate pred returns true. More... | |
| template<typename R , typename F > | |
| auto | rah::for_each (R &&range, F &&func) |
| Applies the given function func to each element of the range. More... | |
| template<typename F > | |
| auto | rah::for_each (F &&func) |
| Applies the given function func to each element of the range. More... | |
| template<typename C , typename R > | |
| auto | rah::to_container (R &&range) |
| Return a container of type C, filled with the content of range. More... | |
| template<typename C > | |
| auto | rah::to_container () |
| Return a container of type C, filled with the content of range. More... | |
| template<typename R1 , typename R2 > | |
| auto | rah::mismatch (R1 &&range1, R2 &&range2) |
| Finds the first position where two ranges differ. More... | |
| template<typename R , typename V > | |
| auto | rah::find (R &&range, V &&value) |
| Finds the first element equal to value. More... | |
| template<typename V > | |
| auto | rah::find (V &&value) |
| Finds the first element equal to value. More... | |
| template<typename R , typename P > | |
| auto | rah::find_if (R &&range, P &&pred) |
| Finds the first element satisfying specific criteria. More... | |
| template<typename P > | |
| auto | rah::find_if (P &&pred) |
| Finds the first element satisfying specific criteria. More... | |
| template<typename R , typename P > | |
| auto | rah::find_if_not (R &&range, P &&pred) |
| Finds the first element not satisfying specific criteria. More... | |
| template<typename P > | |
| auto | rah::find_if_not (P &&pred) |
| Finds the first element not satisfying specific criteria. More... | |
| template<typename R , std ::enable_if_t< is_range< R >::value, int > = 0> | |
| auto | rah::max_element (R &&range) |
| Finds the greatest element in the range. More... | |
| auto | rah::max_element () |
| Finds the greatest element in the range. More... | |
| template<typename R , typename P > | |
| auto | rah::max_element (R &&range, P &&pred) |
| Finds the greatest element in the range. More... | |
| template<typename P , std ::enable_if_t<!is_range< P >::value, int > = 0> | |
| auto | rah::max_element (P &&pred) |
| Finds the greatest element in the range. More... | |
| template<typename R , std ::enable_if_t< is_range< R >::value, int > = 0> | |
| auto | rah::min_element (R &&range) |
| Finds the smallest element in the range. More... | |
| auto | rah::min_element () |
| Finds the smallest element in the range. More... | |
| template<typename R , typename P > | |
| auto | rah::min_element (R &&range, P &&pred) |
| Finds the smallest element in the range. More... | |
| template<typename P , std ::enable_if_t<!is_range< P >::value, int > = 0> | |
| auto | rah::min_element (P &&pred) |
| Finds the smallest element in the range. More... | |
| template<typename R1 , typename R2 > | |
| auto | rah::copy (R1 &&in, R2 &&out) |
| Copy in range into an other. More... | |
| template<typename R2 > | |
| auto | rah::copy (R2 &&out) |
| Copy in range into an other. More... | |
| template<typename R1 , typename V > | |
| auto | rah::fill (R1 &&in, V &&value) |
| Assigns the given value to the elements in the range [first, last) More... | |
| template<typename V > | |
| auto | rah::fill (V &&value) |
| Assigns the given value to the elements in the range [first, last) More... | |
| template<typename R1 , typename R2 > | |
| auto | rah::back_insert (R1 &&in, R2 &&out) |
| Insert in in back of front More... | |
| template<typename R2 > | |
| auto | rah::back_insert (R2 &&out) |
| Insert in in back of front More... | |
| template<typename R1 , typename R2 , typename P > | |
| auto | rah::copy_if (R1 &&in, R2 &&out, P &&pred) |
| Copies the elements for which the predicate pred returns true. More... | |
| template<typename R2 , typename P > | |
| auto | rah::copy_if (R2 &&out, P &&pred) |
| Copies the elements for which the predicate pred returns true. More... | |
| template<typename R > | |
| auto | rah::size (R &&range) |
| Get the size of range. More... | |
| auto | rah::size () |
| Get the size of range. More... | |
| template<typename R1 , typename R2 > | |
| auto | rah::equal (R1 &&range1, R2 &&range2) |
| Determines if two sets of elements are the same. More... | |
| template<typename R1 > | |
| auto | rah::equal (R1 &&range2) |
| Determines if two sets of elements are the same. More... | |
| template<typename S > | |
| auto | rah::stream_inserter (S &&stream) |
| Make a range which output to a stream. More... | |
| template<typename R , typename P > | |
| auto | rah::remove_if (R &&range, P &&pred) |
| Keep at the begining of the range only elements for which pred(elt) is false . More... | |
| template<typename P > | |
| auto | rah::remove_if (P &&pred) |
| Keep at the begining of the range only elements for which pred(elt) is false . More... | |
| template<typename R , typename V > | |
| auto | rah::remove (R &&range, V &&value) |
| Keep at the begining of the range only elements not equal to value . More... | |
| template<typename V > | |
| auto | rah::remove (V &&value) |
| Keep at the begining of the range only elements not equal to value . More... | |
| template<typename R , typename P > | |
| auto | rah::partition (R &&range, P &&pred) |
Reorders the elements in the range in such a way that all elements for which the predicate pred returns true precede the elements for which predicate pred returns false. More... | |
| template<typename P > | |
| auto | rah::partition (P &&pred) |
| template<typename R , typename P > | |
| auto | rah::stable_partition (R &&range, P &&pred) |
Reorders the elements in the range in such a way that all elements for which the predicate pred returns true precede the elements for which predicate pred returns false. More... | |
| template<typename P > | |
| auto | rah::stable_partition (P &&pred) |
| template<typename C , typename R > | |
| auto | rah::erase (C &&container, R &&subrange) |
| Erase a sub-range of a given container. More... | |
| template<typename R > | |
| auto | rah::erase (R &&range) |
| Erase a sub-range of a given container. More... | |
| template<typename R , typename P = is_lesser, typename = std ::enable_if_t<is_range<R>::value>> | |
| void | rah::sort (R &range, P &&pred={}) |
| Sort a range in place, using the given predicate. More... | |
| template<typename P = is_lesser, typename = std ::enable_if_t<not is_range<P>::value>> | |
| auto | rah::sort (P &&pred={}) |
| Sort a range in place, using the given predicate. More... | |
| template<typename R , typename P = is_lesser, typename = std ::enable_if_t<is_range<R>::value>> | |
| void | rah::stable_sort (R &range, P &&pred={}) |
| Sorts the elements in the range in ascending order. More... | |
| template<typename P = is_lesser, typename = std ::enable_if_t<not is_range<P>::value>> | |
| auto | rah::stable_sort (P &&pred={}) |
| Sorts the elements in the range in ascending order. More... | |
| template<typename R , typename URBG > | |
| void | rah::shuffle (R &range, URBG &&g) |
| Reorders the elements in the given range such that each possible permutation of those elements has equal probability of appearance. More... | |
| template<typename URBG > | |
| auto | rah::shuffle (URBG &&g) |
| Reorders the elements in the given range such that each possible permutation of those elements has equal probability of appearance. More... | |
| template<typename R , typename P = is_equal, typename = std ::enable_if_t<is_range<R>::value>> | |
| auto | rah::unique (R &&range, P &&pred={}) |
| Remove all but first successuve values which are equals. More... | |
| template<typename P = is_equal, typename = std ::enable_if_t<not is_range<P>::value>> | |
| auto | rah::unique (P &&pred={}) |
| Remove all but first successuve values which are equals. More... | |
| template<typename IN1 , typename IN2 , typename OUT_ > | |
| void | rah::set_difference (IN1 &&in1, IN2 &&in2, OUT_ &&out) |
| Copies the elements from the sorted range in1 which are not found in the sorted range in2 to the range out The resulting range is also sorted. More... | |
| template<typename IN1 , typename IN2 , typename OUT_ > | |
| void | rah::set_intersection (IN1 &&in1, IN2 &&in2, OUT_ &&out) |
| Copies the elements from the sorted range in1 which are also found in the sorted range in2 to the range out The resulting range is also sorted. More... | |
| template<typename C , typename P = is_equal, typename = std ::enable_if_t<is_range<C>::value>> | |
| auto && | rah::action::unique (C &&container, P &&pred={}) |
| Remove all but first successive values which are equals. More... | |
| template<typename P = is_equal, typename = std ::enable_if_t<not is_range<P>::value>> | |
| auto | rah::action::unique (P &&pred={}) |
| Remove all but first successuve values which are equals. More... | |
| template<typename C , typename P > | |
| auto && | rah::action::remove_if (C &&container, P &&pred) |
| Keep only elements for which pred(elt) is false . More... | |
| template<typename P > | |
| auto | rah::action::remove_if (P &&pred) |
| Keep only elements for which pred(elt) is false . More... | |
| template<typename C , typename V > | |
| auto && | rah::action::remove (C &&container, V &&value) |
| Keep only elements not equal to value. More... | |
| template<typename V > | |
| auto | rah::action::remove (V &&value) |
| Keep only elements not equal to value. More... | |
| template<typename C , typename P = is_lesser, typename = std ::enable_if_t<is_range<C>::value>> | |
| auto && | rah::action::sort (C &&container, P &&pred={}) |
| Sort a range in place, using the given predicate. More... | |
| template<typename P = is_lesser, typename = std ::enable_if_t<not is_range<P>::value>> | |
| auto | rah::action::sort (P &&pred={}) |
| Sort a range in place, using the given predicate. More... | |
| template<typename C , typename URBG > | |
| auto && | rah::action::shuffle (C &&container, URBG &&g) |
| Reorders the elements in the given range such that each possible permutation of those elements has equal probability of appearance. More... | |
| template<typename URBG > | |
| auto | rah::action::shuffle (URBG &&g) |
| Reorders the elements in the given range such that each possible permutation of those elements has equal probability of appearance. More... | |
| template<typename R1 , typename V > | |
| auto | rah::action::fill (R1 &&in, V &&value) |
| Assigns the given value to the elements in the range [first, last) More... | |
| template<typename V > | |
| auto | rah::action::fill (V &&value) |
| Assigns the given value to the elements in the range [first, last) More... | |
| #define RAH_NAMESPACE rah |
| #define RAH_STD std |
1.8.15