Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)
« « « Anklang Documentation |
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, bool > | binary_lookup_fuzzy (RandIter begin, RandIter end, Cmp cmp_elements, const Arg &arg) |
template<typename RandIter , class Cmp , typename Arg > | |
std::pair< RandIter, bool > | binary_lookup_insertion_pos (RandIter begin, RandIter end, Cmp cmp_elements, const Arg &arg) |
template<typename RandIter , class Cmp , typename Arg > | |
RandIter | binary_lookup_sibling (RandIter begin, RandIter end, Cmp cmp_elements, const Arg &arg) |
template<typename RandIter , class Cmp , typename Arg > | |
RandIter | binary_lookup (RandIter begin, RandIter end, Cmp cmp_elements, const Arg &arg) |
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) |
Auxillary algorithms brodly useful.
using Ase::Aux::callable_minus = typedef decltype (std::declval<T>() - std::declval<T>()) |
using Ase::Aux::callable_reserve_int = typedef decltype (std::declval<T&>().reserve (int (0))) |
|
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 313 of file utils.hh.
Referenced by Ase::EventList< Event, Compare >::lookup(), and Ase::EventList< Event, Compare >::remove().
|
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 289 of file utils.hh.
Referenced by Ase::AudioParams::index(), insert_sorted(), Ase::EventList< Event, Compare >::lookup_after(), and Ase::EventList< Event, Compare >::replace().
|
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).
Container Ase::Aux::container_copy | ( | const Iteratable & | source | ) |
Create a Container
with copies of the elements of source
.
Definition at line 239 of file utils.hh.
References std::back_inserter(), std::begin(), std::copy(), and std::end().
bool Ase::Aux::contains | ( | const C & | container, |
const std::function< bool(typename C::value_type const &value)> & | pred | ||
) |
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 350 of file utils.hh.
Referenced by Ase::MakeIcon::KwIcon().
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 337 of file utils.hh.
Referenced by Ase::AudioProcessor::disconnect(), Ase::AudioProcessor::disconnect_event_input(), and Ase::ProjectImpl::remove_track().
ssize_t Ase::Aux::index_of | ( | const IterableContainer & | c, |
const std::function< bool(const typename IterableContainer::value_type &e)> & | match | ||
) |
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 376 of file utils.hh.
References binary_lookup_insertion_pos().
Referenced by Ase::MidiLib::MidiProducerImpl::render().