KiCad PCB EDA Suite
Loading...
Searching...
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.

Namespaces

namespace  alg
 

Functions

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<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.
 
template<class Container1Iter , class Container2Iter >
int alg::lexicographical_compare_three_way (Container1Iter aC1_first, Container1Iter aC1_last, Container2Iter aC2_first, Container2Iter aC2_last)
 Compares two containers lexicographically.