KiCad PCB EDA Suite
No Matches
kicad_algo.h File Reference
#include <algorithm>
#include <functional>
#include <utility>
#include <vector>
#include <wx/debug.h>

Go to the source code of this file.


namespace  alg


template<typename _Type , typename _Function >
void alg::run_on_pair (std::pair< _Type, _Type > &__pair, _Function __f)
 Apply a function to the first and second element of a std::pair.
template<typename _InputIterator , typename _Function >
void alg::adjacent_pairs (_InputIterator __first, _InputIterator __last, _Function __f)
 Apply a function to every sequential pair of elements of a sequence.
template<typename _InputIterator , typename _Function >
void alg::for_all_pairs (_InputIterator __first, _InputIterator __last, _Function __f)
 Apply a function to every possible pair of elements of a sequence.
template<class _Container , typename _Value >
bool alg::contains (const _Container &__container, _Value __value)
 Returns true if the container contains the given value.
template<typename _Type , typename _Value >
bool alg::pair_contains (const std::pair< _Type, _Type > __pair, _Value __value)
 Returns true if either of the elements in an std::pair contains the given value.
template<class T >
bool alg::within_wrapped_range (T __val, T __minval, T __maxval, T __wrap)
 Test if __val lies within __minval and __maxval in a wrapped range.
template<class _Container , typename _Value >
void alg::delete_matching (_Container &__c, _Value __value)
 Covers for the horrifically named std::remove and std::remove_if (neither of which remove anything).
template<class _Container , class _Function >
void alg::delete_if (_Container &__c, _Function &&__f)
 Deletes all values from __c for which __f returns true.
template<class _Container >
void alg::remove_duplicates (_Container &__c)
 Deletes all duplicate values from __c.
template<class _Container , class _Function >
void alg::remove_duplicates (_Container &__c, _Function &&__f)
template<typename T , std::enable_if_t< std::is_integral< T >::value, int > = 0>
bool alg::signbit (T v)
 Integral version of std::signbit that works all compilers.
template<typename T >
alg::clamp (T min, T value, T max)
template<class _Container >
size_t alg::longest_common_subset (const _Container &__c1, const _Container &__c2)
 Returns the length of the longest common subset of values between two containers.