4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
fcppt::algorithm Namespace Reference

General-purpose algorithms. More...

Classes

struct  loop_break_impl
 Customization point for ranges. More...
 
struct  loop_break_impl< Range, std::enable_if_t< fcppt::mpl::list::is_object< Range >::value > >
 
struct  loop_break_impl< Range, std::enable_if_t< fcppt::record::is_object< Range >::value > >
 
struct  loop_break_impl< Range, std::enable_if_t< fcppt::tuple::is_object< Range >::value > >
 
struct  map_impl
 
struct  map_impl< Source, Target, std::enable_if_t< std::conjunction_v< fcppt::array::is_object< Target >, fcppt::array::is_object< Source > > > >
 
struct  map_impl< Source, Target, std::enable_if_t< std::conjunction_v< fcppt::record::is_object< Target >, fcppt::record::is_object< Source > > > >
 
struct  map_impl< Source, Target, std::enable_if_t< std::conjunction_v< fcppt::tuple::is_object< Target >, fcppt::tuple::is_object< Source > > > >
 

Typedefs

template<typename Range >
using range_element_type = decltype(*std::declval<Range>().begin())
 The type of a range element.
 

Enumerations

enum class  update_action : std::uint8_t { update_action::keep , update_action::remove }
 Update action for container iteration. More...
 

Functions

template<typename Range , typename Pred >
bool all_of (Range const &_range, Pred const &_pred)
 Checks if a given predicate is true for all elements of a range.
 
template<typename Range , typename T >
fcppt::optional::object< fcppt::container::to_iterator_type< std::remove_reference_t< Range > > > binary_search (Range &&_range, T const &_value)
 Finds an element by binary search.
 
template<typename Range , typename T >
bool contains (Range const &_range, T const &_value)
 Checks if a given value is inside a range.
 
template<typename Range , typename Pred >
bool contains_if (Range const &_range, Pred const &_pred)
 Checks if a given value is inside a range, using a predicate.
 
template<typename Range1 , typename Range2 >
bool equal (Range1 const &_range1, Range2 const &_range2)
 Compares two ranges for equality.
 
template<typename Range , typename T >
fcppt::iterator::range< fcppt::container::to_iterator_type< std::remove_reference_t< Range > > > equal_range (Range &&_range, T const &_value)
 Returns the equal range of a given range and a value.
 
template<typename Result , typename Range , typename Function >
fcppt::optional::object< Result > find_by_opt (Range &&_range, Function const &_function)
 Optionally finds an element and transforms it.
 
template<typename Range , typename Comp >
fcppt::optional::object< fcppt::container::to_iterator_type< std::remove_reference_t< Range > > > find_if_opt (Range &&_range, Comp const &_comp)
 Like std::find_if but returns an empty optional on failure.
 
template<typename Range , typename T >
fcppt::optional::object< fcppt::container::to_iterator_type< std::remove_reference_t< Range > > > find_opt (Range &&_range, T const &_value)
 Like std::find but returns an empty optional on failure.
 
template<typename Range , typename State , typename Function >
State fold (Range &&_range, State _state, Function _function)
 Folds a range into a value.
 
template<typename Range , typename State , typename Function >
State fold_break (Range &&_range, State _state, Function _function)
 Folds a range into a value, can break out early.
 
template<typename TargetContainer , typename Function >
TargetContainer generate_n (std::size_t const _count, Function const &_function)
 Generates a container by calling a function a number of times.
 
template<typename Range , typename T >
fcppt::optional::object< typename Range::size_type > index_of (Range const &_range, T const &_value)
 Returns the index of the first element found in a sequence.
 
template<typename Range >
fcppt::type_traits::value_type< Range > join_strings (Range const &_range, fcppt::type_traits::value_type< Range > const &_delim)
 Joins a range of strings, using a delimiter.
 
template<typename Range , typename Body >
void loop (Range &&_range, Body const &_body)
 Iterates through a range.
 
template<typename Range , typename Body >
void loop_break (Range &&_range, Body const &_body)
 Iterates through a range with the ability to break out of the loop.
 
template<typename TargetContainer , typename SourceRange , typename Function >
TargetContainer map (SourceRange &&_source, Function const &_function)
 Transforms a range to another container by applying a function to every element.
 
template<typename TargetContainer , typename Range , typename Function >
TargetContainer map_concat (Range &&_range, Function const &_function)
 Maps a range to other sequences and joins them.
 
template<typename Map , typename UpdateAction >
void map_iteration (Map &_map, UpdateAction const &_update_action)
 Iterates over a map with the possibility of erasing elements.
 
template<typename Map , typename UpdateAction >
void map_iteration_second (Map &_map, UpdateAction const &_update_action)
 Iterates over a map with the possibility of erasing elements, passing second.
 
template<typename TargetContainer , typename Source , typename Function >
TargetContainer map_optional (Source &&_source, Function const &_function)
 Transforms a range to another container by applying a function to every element, only inserting the results that are not empty optionals.
 
template<typename Container >
bool remove (Container &_container, typename Container::const_reference _element)
 Removes all occurrences of a value from a container.
 
template<typename Container , typename Predicate >
bool remove_if (Container &_container, Predicate const &_predicate)
 Removes all elements from a container matching a predicate.
 
template<typename Count , typename Function >
void repeat (Count const _count, Function const &_function)
 Calls a function a number of times.
 
template<typename Container >
std::remove_cvref_t< Container > reverse (Container &&_container)
 Reverses a container.
 
template<typename Sequence , typename UpdateAction >
void sequence_iteration (Sequence &_sequence, UpdateAction const &_update_action)
 Iterates over a sequence with the possibility of erasing elements.
 
template<typename String >
std::vector< String > split_string (String const &_string, fcppt::type_traits::value_type< String > const _delim)
 Splits a string, using a delimiter.
 
template<typename Container >
void unique (Container &_container)
 Removes duplicate elements from a container.
 
template<typename Container , typename BinaryPredicate >
void unique_if (Container &_container, BinaryPredicate const &_predicate)
 Removes duplicate elements from a container. Compares using a predicate.
 

Detailed Description

General-purpose algorithms.