Overview
Examples
Screenshots
Comparisons
Applications
Download
Manual
Status & Roadmap
FAQ
Authors & License
Forums
Wiki
Funding Ultimate++
Search on this site











SourceForge.net Logo



Algorithms

 

template <class T>  void Swap(Ta, Tb)

Swaps values. Specific types might specialize Swap with more effective variants.

T must have either deep copy operator or pick operator.

T

Type of values.

a

First value to swap.

b

Second value to swap.

 

template <class I>  void IterSwap(I a, I b)

Swaps values pointed to by iterators. Specific types might specialize IterSwap with more effective variants.

Swap must be defined for type pointed to by I.

I

Iterator type.

a

Iterator pointing to first value.

b

Iterator pointing to second value.

 

template <class C, class T, class L>  int FindLowerBound(const Cv, int pos, int count, const Tval, const Lless)

Finds first position in range of container sorted by less predicate where val can be inserted without breaking the ordering.

C

Type of container.

T

Type of value.

v

Container.

pos

Beginning of range.

count

Number of elements in range.

val

Value to find.

less

Ordering predicate.

Return value

Position in container.

 

template <class C, class T, class L>  int FindLowerBound(const Cv, const Tval, const Lless)

Finds first position in sorted by less predicate where val can be inserted without breaking the ordering.

C

Type of container.

T

Type of value.

v

Container.

val

Value to find.

less

Ordering predicate.

Return value

Position in container.

 

template <class C, class T>  int FindLowerBound(const Cv, const Tval)

Finds first position in sorted by operator< predicate where val can be inserted without breaking the ordering.

C

Type of container.

T

Type of value.

v

Container.

val

Value to find.

Return value

Position in container.

 

template <class C, class T, class L>  int FindUpperBound(const Cv, int pos, int count, const Tval, const Lless)

Finds last position in range of container sorted by less predicate where val can be inserted without breaking the ordering.

C

Type of container.

T

Type of value.

v

Container.

pos

Beginning of range.

count

Number of elements in range.

val

Value to find.

less

Ordering predicate.

Return value

Position in container.

 

template <class C, class T, class L>  int FindUpperBound(const Cv, const Tval, const Lless)

Finds last position in sorted by less predicate where val can be inserted without breaking the ordering.

C

Type of container.

T

Type of value.

v

Container.

val

Value to find.

less

Ordering predicate.

Return value

Position in container.

 

template <class C, class T>  int FindUpperBound(const Cv, const Tval)

Finds last position in sorted by operator< predicate where val can be inserted without breaking the ordering.

C

Type of container.

T

Type of value.

v

Container.

val

Value to find.

Return value

Position in container.

 

template <class C, class T, class L>  int FindBinary(const Cv, const Tval, int pos, int count, const Lless)

Finds position of element with specified value in a range of container sorted by less predicate. If no such element exists, a negative value is returned.

C

Type of container.

T

Type of value.

v

Container.

pos

Beginning of range.

count

Number of elements in range.

val

Value to find.

less

Ordering predicate.

Return value

Position in container.

 

template <class C, class T, class L>  int FindBinary(const Cv, const Tval, const Lless)

Finds position of element with specified value in the container sorted by less predicate. If no such element exists, a negative value is returned.

C

Type of container.

T

Type of value.

v

Container.

val

Value to find.

less

Ordering predicate.

Return value

Position in container.

 

template <class C, class T>  int FindBinary(const Cv, const Tval)

Finds position of element with specified value in the container sorted by operator< predicate. If no such element exists, a negative value is returned.

C

Type of container.

T

Type of value.

v

Container.

val

Value to find.

Return value

Position in container.

 

template <class C, class L>  CAppendSorted(Cdest, const Csrc, const Lless)

Merges source NTL container to destination NTL container. Both containers must be sorted in ascending order. After the operation, destination container is sorted in ascending order and contains values from both containers. Duplicate values are preserved. Ordering predicate is determined by less.

C

Type of container.

dest

Destination container.

src

Source container.

less

Ordering predicate.

Return value

Destination container.template<class C>

 

template <class C>  CAppendSorted(Cdest, const Csrc)

Merges source NTL container to destination NTL container. Both containers must be sorted in ascending order. After the operation, destination container is sorted in ascending order and contains values from both containers. Duplicate values are preserved. Ordering is determined by operator<.

C

Type of container.

dest

Destination container.

src

Source container.

Return value

Destination container.template<class C>

 

template <class C, class L>  CUnionSorted(Cdest, const Csrc, const Lless)

Merges source NTL container to destination NTL container. Both containers must be sorted in ascending order and values must be unique. After the operation, destination container is sorted in ascending order and contains unique values from both containers. Ordering is determined by less.

C

Type of container.

dest

Destination container.

src

Source container.

less

Ordering predicate.

Return value

Destination container.

 

template <class C>  CUnionSorted(Cdest, const Csrc)

Merges the source NTL container to the destination NTL container. Both containers must be sorted in ascending order and values must be unique. After the operation, destination container is sorted in ascending order and contains unique values from both containers. Ordering is determined by operator<.

C

Type of container.

dest

Destination container.

src

Source container.

Return value

Destination container.

 

template <class C, class L>  CRemoveSorted(Cfrom, const Cwhat, const Lless)

Removes elements of source container from destination container. Both containers must be sorted in ascending order and values must be unique. Ordering is determined by less.

C

Type of container.

from

Destination container.

what

Source container.

less

Ordering predicate.

Return value

Destination container.

 

template <class C>  CRemoveSorted(Cfrom, const Cwhat)

Removes elements of source container from destination container. Both containers must be sorted in ascending order and values must be unique. Ordering is determined by operator<.

C

Type of container.

from

Destination container.

what

Source container.

Return value

Destination container.

 

template <class D, class S, class L>  DIntersectSorted(Ddest, const Ssrc, const Lless)

Removes elements from destination container that are not contained in source container. Both containers must be sorted in ascending order and values must be unique. Ordering is determined by less.

D

Type of destination container.

S

Type of source container.

dest

Destination container.

src

Source container.

less

Destination container.

 

template <class D, class S>  DIntersectSorted(Ddest, const Ssrc)

Removes elements from destination container that are not contained in source container. Both containers must be sorted in ascending order and values must be unique. Ordering is determined by operator<.

D

Type of destination container.

S

Type of source container.

dest

Destination container.

src

Source container.

Return value

Destination container.

 

template <class T, class Less>  void Sort(Tc, const Lessless)

Sorts container. Ordering is determined by less.

IterSwap must be defined for T::Iterator.

T

Type of container.

c

Container.

less

Ordering predicate.

 

template <class T>  void Sort(Tc)

Sorts container. Ordering is determined by operator<.

IterSwap must be defined for T::Iterator.

T

Type of container.

c

Container.

 

template <class KC, class VC, class Less>  void IndexSort(KCkeys, VCvalues, const Lessless)

Sorts pair of containers. Both containers must have same number of items. Resulting order is determined by the keys container. Ordering is determined by less.

KC

Type of keys container.

VC

Type of values.

keys

Container of keys.

values

Container of values.

less

Ordering predicate.

 

template <class KC, class VC>  void IndexSort(KCkeys, VCvalues)

Sorts pair of containers. Both containers must have same number of items. Resulting order is determined by the keys container. Ordering is determined by operator<.

KC

Type of keys container.

VC

Type of values container.

keys

Container of keys.

values

Container of values.

 

template <class C, class Less>  Vector<intGetSortOrder(const Ccontainer, const Lessless)

Creates ascending order of values in container. Ordering is determined by less.

C

Type of container.

container

Source container.

less

Ordering predicate.

Return value

Vector of positions of source container in sorted order.

 

template <class C>  Vector<intGetSortOrder(const Ccontainer)

Creates ascending order of values in container. Ordering is determined by operator<.

C

Type of container.

container

Source container.

Return value

Vector of positions of source container in sorted order.

 

template <class O, class T, class R>  FieldRelationCls<O, T, RFieldRelation(O (T::*member), const Rrelation)

Creates ordering predicate for T based on the value of member variable of T.

T

Type of element.

member

Member variable of T.

relation

Ordering relation for member.

Return value

Ordering predicate.

 

template <class O, class T, class R>  MethodRelationCls<O (T::*)(), T, RMethodRelation(O (T::*method)(), const Rrelation)

Creates ordering predicate for T based on the value returned by non-const method of T.

T

Type of element.

method

Method of T.

relation

Ordering relation for value returned by method.

Return value

Ordering predicate.

 

template <class O, class T, class R>  MethodRelationCls<O (T::*)() const, T, RMethodRelation(O (T::*method)() const, const Rrelation)

Creates ordering predicate for T based on the value returned by const method of T.

T

Type of element.

method

Method of T.

relation

Ordering relation for value returned by method.

Return value

Ordering predicate.