mimic++ v9.2.1
Loading...
Searching...
No Matches
Algorithm.hpp File Reference
#include "mimic++/config/Config.hpp"
#include "mimic++/utilities/C++26Backports.hpp"
#include <algorithm>
#include <array>
#include <concepts>
#include <functional>
#include <iterator>
#include <ranges>
#include <string_view>
#include <tuple>
#include <type_traits>
#include <utility>
Include dependency graph for Algorithm.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  mimicpp
 
namespace  mimicpp::util
 

Functions

template<std::ranges::random_access_range Target, std::ranges::random_access_range Control, typename Projection = std::identity, std::indirect_unary_predicate< std::projected< std::ranges::iterator_t< Control >, Projection > > Predicate>
requires std::ranges::sized_range<Target> && std::ranges::sized_range<Control>
constexpr std::ranges::borrowed_subrange_t< Target > mimicpp::util::partition_by (Target &&targetRange, Control &&controlRange, Predicate predicate, Projection projection={})
 Partitions the target range by the predicate results on the control range.
 
template<std::ranges::borrowed_range Range>
constexpr std::ranges::borrowed_iterator_t< Range > mimicpp::util::find_closing_token (Range &&str, std::ranges::range_value_t< Range > const &openingToken, std::ranges::range_value_t< Range > const &closingToken)
 Finds the next closing token in the given string.
 
template<std::ranges::borrowed_range Range>
constexpr std::ranges::borrowed_subrange_t< Range > mimicpp::util::find_next_unwrapped_token (Range &&str, std::string_view const token, std::ranges::forward_range auto &&opening, std::ranges::forward_range auto &&closing)
 Finds the next unwrapped token in the given string.
 
template<std::ranges::forward_range Range, std::ranges::forward_range Prefix>
requires std::totally_ordered_with<std::ranges::range_value_t<Range>, Prefix>
constexpr std::ranges::borrowed_subrange_t< Range > mimicpp::util::prefix_range (Range &&range, Prefix &&prefix)
 Returns a view containing all elements, which start with the given prefix.
 
template<std::copyable T, std::size_t firstN, std::size_t secondN>
constexpr std::array< T, firstN+secondN > mimicpp::util::concat_arrays (std::array< T, firstN > const &first, std::array< T, secondN > const &second)
 Concatenates the given arrays by copying all elements into a new array.
 
template<std::copyable T, std::size_t firstN, typename... Others>
requires (... && std::same_as<T, std::ranges::range_value_t<Others>>) && (... && (0u <= std::tuple_size_v<Others>))
constexpr auto mimicpp::util::concat_arrays (std::array< T, firstN > const &first, Others const &... others)
 Concatenates the given arrays by copying all elements into a new array.
 

Variables

constexpr detail::binary_find_fn mimicpp::util::binary_find {}
 Finds the specified value within the container and returns an iterator pointing to it. If the value is not found, it returns an iterator to the end of the container.
 
constexpr detail::contains_fn mimicpp::util::contains {}
 Determines, whether the specified value is contained in the given range.