Anklang-0.3.0.dev595+g65331842 anklang-0.3.0.dev595+g65331842
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
Typedefs | Functions
Ase::Aux Namespace Reference

Auxillary algorithms brodly useful. More...

Typedefs

template<typename T >
using callable_reserve_int = decltype(std::declval< T & >().reserve(int(0)))
 
template<typename T >
using callable_minus = decltype(std::declval< T >() - std::declval< T >())
 

Functions

template<class Container , class Iteratable >
Container container_copy (const Iteratable &source)
 Create a Container with copies of the elements of source.
 
template<typename RandIter , class Cmp , typename Arg , int case_lookup_or_sibling_or_insertion>
std::pair< RandIter, boolbinary_lookup_fuzzy (RandIter begin, RandIter end, Cmp cmp_elements, const Arg &arg)
 
template<typename RandIter , class Cmp , typename Arg >
std::pair< RandIter, boolbinary_lookup_insertion_pos (RandIter begin, RandIter end, Cmp cmp_elements, const Arg &arg)
 Perform a binary lookup to find the insertion position for a new element.
 
template<typename RandIter , class Cmp , typename Arg >
RandIter binary_lookup_sibling (RandIter begin, RandIter end, Cmp cmp_elements, const Arg &arg)
 Perform a binary lookup to yield exact or nearest match.
 
template<typename RandIter , class Cmp , typename Arg >
RandIter binary_lookup (RandIter begin, RandIter end, Cmp cmp_elements, const Arg &arg)
 Perform binary lookup and yield exact match or end.
 
template<class C >
size_t erase_first (C &container, const std::function< bool(typename C::value_type const &value)> &pred)
 Erase first element for which pred() is true in vector or list.
 
template<class C >
size_t erase_all (C &container, const std::function< bool(typename C::value_type const &value)> &pred)
 Erase all elements for which pred() is true in vector or list.
 
template<typename C >
bool contains (const C &container, const std::function< bool(typename C::value_type const &value)> &pred)
 Returns true if container element for which pred() is true.
 
template<class T , class Compare >
std::vector< T >::iterator insert_sorted (std::vector< T > &vec, const T &value, Compare compare)
 Insert value into sorted vec using binary_lookup_insertion_pos() with compare.
 
template<class IterableContainer >
ssize_t index_of (const IterableContainer &c, const std::function< bool(const typename IterableContainer::value_type &e)> &match)
 

Detailed Description

Auxillary algorithms brodly useful.

Typedef Documentation

◆ callable_minus

template<typename T >
using Ase::Aux::callable_minus = typedef decltype (std::declval<T>() - std::declval<T>())

Definition at line 166 of file utils.hh.

◆ callable_reserve_int

template<typename T >
using Ase::Aux::callable_reserve_int = typedef decltype (std::declval<T&>().reserve (int (0)))

Definition at line 164 of file utils.hh.

Function Documentation

◆ binary_lookup()

template<typename RandIter , class Cmp , typename Arg >
RandIter Ase::Aux::binary_lookup ( RandIter  begin,
RandIter  end,
Cmp  cmp_elements,
const Arg &  arg 
)
extern

Perform binary lookup and yield exact match or end.

The arguments [ begin, end [ denote the range used for the lookup, arg is passed along with the current element to the cmp_elements function.

Definition at line 244 of file utils.hh.

Referenced by Ase::EventList< Event, Compare >::lookup(), and Ase::EventList< Event, Compare >::remove().

◆ binary_lookup_fuzzy()

template<typename RandIter , class Cmp , typename Arg , int case_lookup_or_sibling_or_insertion>
std::pair< RandIter, bool > Ase::Aux::binary_lookup_fuzzy ( RandIter  begin,
RandIter  end,
Cmp  cmp_elements,
const Arg &  arg 
)
extern

Definition at line 185 of file utils.hh.

◆ binary_lookup_insertion_pos()

template<typename RandIter , class Cmp , typename Arg >
std::pair< RandIter, bool > Ase::Aux::binary_lookup_insertion_pos ( RandIter  begin,
RandIter  end,
Cmp  cmp_elements,
const Arg &  arg 
)
extern

Perform a binary lookup to find the insertion position for a new element.

Return (end,false) for end-begin==0, or return (position,true) for exact match, otherwise return (position,false) where position indicates the location for the key to be inserted (and may equal end).

Definition at line 220 of file utils.hh.

Referenced by Ase::AudioParams::index(), insert_sorted(), Ase::EventList< Event, Compare >::lookup_after(), and Ase::EventList< Event, Compare >::replace().

◆ binary_lookup_sibling()

template<typename RandIter , class Cmp , typename Arg >
RandIter Ase::Aux::binary_lookup_sibling ( RandIter  begin,
RandIter  end,
Cmp  cmp_elements,
const Arg &  arg 
)
extern

Perform a binary lookup to yield exact or nearest match.

return end for end-begin==0, otherwise return the exact match element, or, if there's no such element, return the element last visited, which is pretty close to an exact match (will be one off into either direction).

Definition at line 232 of file utils.hh.

◆ container_copy()

template<class Container , class Iteratable >
Container Ase::Aux::container_copy ( const Iteratable &  source)

Create a Container with copies of the elements of source.

Definition at line 170 of file utils.hh.

References std::back_inserter(), std::begin(), std::copy(), and std::end().

◆ contains()

template<typename C >
bool Ase::Aux::contains ( const C &  container,
const std::function< bool(typename C::value_type const &value)> &  pred 
)

Returns true if container element for which pred() is true.

Definition at line 297 of file utils.hh.

◆ erase_all()

template<class C >
size_t Ase::Aux::erase_all ( C &  container,
const std::function< bool(typename C::value_type const &value)> &  pred 
)

Erase all elements for which pred() is true in vector or list.

Definition at line 281 of file utils.hh.

Referenced by Ase::MakeIcon::KwIcon().

◆ erase_first()

template<class C >
size_t Ase::Aux::erase_first ( C &  container,
const std::function< bool(typename C::value_type const &value)> &  pred 
)

Erase first element for which pred() is true in vector or list.

Definition at line 268 of file utils.hh.

Referenced by Ase::AudioProcessor::disconnect(), Ase::AudioProcessor::disconnect_event_input(), and Ase::ProjectImpl::remove_track().

◆ index_of()

template<class IterableContainer >
ssize_t Ase::Aux::index_of ( const IterableContainer &  c,
const std::function< bool(const typename IterableContainer::value_type &e)> &  match 
)

Definition at line 316 of file utils.hh.

◆ insert_sorted()

template<class T , class Compare >
std::vector< T >::iterator Ase::Aux::insert_sorted ( std::vector< T > &  vec,
const T &  value,
Compare  compare 
)

Insert value into sorted vec using binary_lookup_insertion_pos() with compare.

Definition at line 307 of file utils.hh.

References binary_lookup_insertion_pos().

Referenced by Ase::MidiLib::MidiProducerImpl::render().