KiCad PCB EDA Suite
alg Namespace Reference

Functions

template<typename _InputIterator , typename _Function >
void adjacent_pairs (_InputIterator __first, _InputIterator __last, _Function __f)
 Apply a function to every sequential pair of elements of a sequence. More...
 
template<typename _InputIterator , typename _Function >
void for_all_pairs (_InputIterator __first, _InputIterator __last, _Function __f)
 Apply a function to every possible pair of elements of a sequence. More...
 
template<class _Container , typename _Value >
bool contains (const _Container &__container, _Value __value)
 Returns true if the container contains the given value. More...
 

Function Documentation

◆ adjacent_pairs()

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.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__fA unary function object.

Applies the function object __f to each sequential pair of elements in the range [first,last). __f must not modify the order of the sequence. If __f has a return value it is ignored.

Definition at line 43 of file kicad_algo.h.

44 {
45  if( __first != __last )
46  {
47  _InputIterator __follow = __first;
48  ++__first;
49  for( ; __first != __last; ++__first, ++__follow )
50  __f( *__follow, *__first );
51  }
52 }

◆ contains()

◆ for_all_pairs()

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.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__fA unary function object.

Applies the function object __f to every possible pair of elements in the range [first,last). __f must not modify the order of the sequence. If __f has a return value it is ignored.

Definition at line 65 of file kicad_algo.h.

66 {
67  if( __first != __last )
68  {
69  _InputIterator __follow = __first;
70  ++__first;
71  for( ; __first != __last; ++__first, ++__follow )
72  for( _InputIterator __it = __first; __it != __last; ++__it )
73  __f( *__follow, *__it );
74  }
75 }

Referenced by SCH_EDIT_FRAME::DeleteJunction(), and SCH_EDIT_FRAME::SchematicCleanUp().