MySQL 9.1.0
Source Code Documentation
myu Namespace Reference

Functions

template<class InputIt , class Pred , class Action >
void Split (InputIt first, InputIt last, Pred &&pred, Action &&action)
 Split a range into sub ranges delimited by elements satisfying a predicate. More...
 
template<class InputIt , class Pred >
InputIt FindTrimmedEnd (InputIt first, InputIt last, Pred &&pred)
 Search backwards for the first occurrence of an element which does not satisfy the trimming predicate, and return an InputIt to the element after it. More...
 
template<class InputIt , class Pred >
std::pair< InputIt, InputIt > FindTrimmedRange (InputIt first, InputIt last, Pred &&pred)
 Searches for a sub range such that no elements before or after fail to satisfy the trimming predicate. More...
 

Variables

const auto IsSpace = [](char c) { return isspace(c); }
 Convenience lambdas for common predicates. More...
 
const auto IsComma = [](char c) { return c == ','; }
 

Function Documentation

◆ FindTrimmedEnd()

template<class InputIt , class Pred >
InputIt myu::FindTrimmedEnd ( InputIt  first,
InputIt  last,
Pred &&  pred 
)
inline

Search backwards for the first occurrence of an element which does not satisfy the trimming predicate, and return an InputIt to the element after it.

Parameters
firstBeginning of the range to search.
lastEnd of the range to search.
predCallable which can be applied to a dereferenced InputIt and which returns true if the element should be trimmed.
Returns
InputIt referencing the first element of sub range satisfying the trimming predicate at the end of the range. last if no elements satisfy the trimming predicate.

◆ FindTrimmedRange()

template<class InputIt , class Pred >
std::pair< InputIt, InputIt > myu::FindTrimmedRange ( InputIt  first,
InputIt  last,
Pred &&  pred 
)
inline

Searches for a sub range such that no elements before or after fail to satisfy the trimming predicate.

Parameters
firstBeginning of the range to search.
lastEnd of the range to search.
predCallable which can be applied to a dereferenced InputIt and which returns true if the element should be trimmed.
Returns
Pair of iterators denoting the sub range which does not include the leading and trailing sub ranges matching the trimming predicate. {last, last} if all elements match the trimming predicate.

◆ Split()

template<class InputIt , class Pred , class Action >
void myu::Split ( InputIt  first,
InputIt  last,
Pred &&  pred,
Action &&  action 
)
inline

Split a range into sub ranges delimited by elements satisfying a predicate.

Examines the elements from first to last, exclusive. Each time an element which satisfies the splitting predicate is encountered, the action argument's operator() is invoked with the starting and past-the-end iterators for the current sub-range, even if this is empty. When iteration is complete, action() is called on the range between the start of the last subrange and last.

It must be possible to pass a single element with type const InputIt::value_type to is_split_element. It must be possible to pass two InputIt arguments to action.

Parameters
firstBeginning of the range to split.
lastEnd of the range to split.
predCallable which will be invoked on each element in turn to determine if it is a splitting element.
actionCallable which will be invoked with the beginning and one-past-the-end iterators for each subrange.

Variable Documentation

◆ IsComma

const auto myu::IsComma = [](char c) { return c == ','; }

◆ IsSpace

const auto myu::IsSpace = [](char c) { return isspace(c); }

Convenience lambdas for common predicates.