The Extended Template Library (ETL)<ToolKit> provides a C++ template implementation for various Abstract Data Types. It uses C++ operator overloading uniformly across all container classes included in the library. Below we list some of those operators for reference. The number of operators available is generally much larger including the usual comparison operators and the assignment operator.
Let C be a container and let e be an element for C.
+C := number of elements in C.-C := make C empty.C % e := if e is in C returns 1, else return 0 (membership).C << e := insert e in C (generally at head, or Push, Enqueue etc).C + e := insert e in C (generally at end or tail).--C := remove and return first element in C (head).C-- := remove and return last element in C.*C := return first element in C without removing the element.C >> e := remove e from C (or Pop, Dequeue etc.).C >>= e := remove all occurrences of e in C.When iterating, the following opeators are available either through the Iterator<T> class, or directly supported by the container.
~C := reset(prepare) C for iteration.++C := move to next element in C (prefix).C++ := move to next element in C (postfix).User-defined types used to instantiate template parameters must be well-defined. A type is well-defined when it satisfies the following set of requirements.
This is the minimum required of any type. In the example below, 'const' is one way to overload opeator== for a type T.
int
operator==(const T& t) const
{
// return 1 if equal, 0 otherwise;
}
Copyright©2005-2026 Recursion
Software LLC
All Rights Reserved - For use by licensed users only.