...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
In this section a single matrix is given, that shows all functions with shared names and identical or analogous semantics and their polymorphic overloads across the class templates of the icl. In order to achieve a concise representation, a series of placeholders are used throughout the function matrix.
The placeholder's purpose
is to express the polymorphic usage of the functions. The first column of the function matrix contains
the signatures of the functions. Within these signatures T
denotes a container type and J
and P
polymorphic argument
and result types.
Within the body of the matrix, sets of boldface
placeholders denote the sets of possible instantiations for a polymorphic
placeholder P
. For instance
e i S denotes that for the argument type P
, an element e, an interval i or an interval_set S can be instantiated.
If the polymorphism can not be described in this way, only the number of overloaded implementations for the function of that row is shown.
Placeholder |
Argument types |
Description |
---|---|---|
|
a container or interval type |
|
|
polymorphic container argument type |
|
|
polymorphic iterator type |
|
|
polymorphic element_iterator type for interval containers |
|
|
various types |
|
1,2,... |
number of implementations for this function |
|
A |
implementation generated by compilers |
|
T::element_type |
the element type of |
|
T::segment_type |
the segment type of of |
|
element sets |
|
|
interval_sets |
one of the interval set types |
|
T::element_type |
type of |
|
T::segment_type |
type of |
|
element maps |
|
|
interval_maps |
one of the interval map types |
|
discrete types |
types with a least steppable discrete unit: Integral types, date/time types etc. |
|
continuous types |
types with (theoretically) infinitely many elements beween two values. |
Table 1.13. Synopsis Functions and Overloads
T |
intervals |
interval |
interval |
element |
element |
---|---|---|---|---|---|
|
1 |
1 |
1 |
1 |
1 |
|
A |
1 |
1 |
||
|
A |
1 |
1 |
||
|
1 |
1 |
1 |
1 |
|
intervals |
interval |
interval |
element |
element |
|
|
1 |
1 |
1 |
1 |
|
|
1 |
1 |
1 |
1 |
1 |
|
|||||
intervals |
interval |
interval |
element |
element |
|
|
1 |
1 |
1 |
1 |
1 |
|
1 |
1 |
1 |
1 |
1 |
|
1 |
1 |
1 |
1 |
1 |
|
1 |
1 |
1 |
1 |
1 |
|
1 |
1 |
1 |
1 |
1 |
|
1 |
1 |
1 |
1 |
1 |
|
1 |
1 |
|||
|
1 |
1 |
|||
|
1 |
1 |
|||
|
1 |
||||
intervals |
interval |
interval |
element |
element |
|
|
1 |
1 |
1 |
1 |
|
|
1 |
1 |
1 |
1 |
1 |
|
1 |
1 |
1 |
1 |
1 |
|
1 |
1 |
1 |
||
|
1 |
1 |
1 |
1 |
|
|
1 |
1 |
|||
|
2 |
2 |
|||
|
|||||
|
1 |
||||
|
1 |
1 |
|||
|
1 |
1 |
|||
|
1 |
||||
|
1 |
1 |
1 |
||
|
1 |
1 |
1 |
||
|
1 |
1 |
1 |
||
|
1 |
1 |
1 |
||
intervals |
interval |
interval |
element |
element |
|
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
1 |
||||
|
1 |
||||
intervals |
interval |
interval |
element |
element |
|
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
1 |
||||
|
1 |
||||
|
1 |
1 |
1 |
1 |
|
|
1 |
1 |
1 |
1 |
|
|
|||||
|
|||||
|
1 |
1 |
1 |
1 |
|
|
1 |
1 |
1 |
1 |
|
intervals |
interval |
interval |
element |
element |
|
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
intervals |
interval |
interval |
element |
element |
|
|
2 |
2 |
2 |
2 |
|
|
2 |
2 |
2 |
2 |
|
|
2 |
2 |
2 |
2 |
|
|
2 |
2 |
2 |
2 |
|
|
2 |
2 |
2 |
2 |
|
|
2 |
2 |
2 |
2 |
|
|
2 |
2 |
2 |
2 |
|
intervals |
interval |
interval |
element |
element |
|
|
2 |
2 |
|||
|
2 |
2 |
|||
|
2 |
2 |
|||
|
2 |
2 |
|||
intervals |
interval |
interval |
element |
element |
|
|
1 |
1 |
1 |
1 |
1 |
Many but not all functions of icl intervals
are listed in the table above. Some specific functions are summarized in
the next table. For the group of the constructing functions, placeholders
d
denote discrete domain types and c denote continuous domain types T::domain_type
for an interval_type T
and
an argument types P
.
Table 1.14. Additional interval functions
T |
discrete |
continuous |
right_open |
left_open |
closed |
open |
---|---|---|---|---|---|---|
Interval bounds |
dynamic |
dynamic |
static |
static |
static |
static |
Form |
asymmetric |
asymmetric |
symmetric |
symmetric |
||
|
||||||
|
||||||
|
||||||
|
||||||
|
||||||
|
||||||
|
||||||
|
||||||
|
||||||
|
1 |
1 |
1 |
1 |
1 |
1 |
|
1 |
1 |
1 |
1 |
1 |
1 |
|
1 |
1 |
1 |
1 |
1 |
1 |
|
1 |
1 |
1 |
1 |
1 |
1 |
|
1 |
1 |
1 |
1 |
1 |
1 |
|
1 |
1 |
1 |
1 |
1 |
1 |
Iterators on interval conainers that are refered to in section Iteration of the function synopsis table are segment iterators. They reveal the more implementation specific aspect, that the fundamental aspect abstracts from. Iteration over segments is fast, compared to an iteration over elements, particularly if intervals are large. But if we want to view our interval containers as containers of elements that are usable with std::algoritms, we need to iterate over elements.
Iteration over elements . . .
domain_types
On the other hand, sometimes iteration over interval containers on the element
level might be desired, if you have some interface that works for std::SortedAssociativeContainers
of elements and you need to quickly use it with an interval container. Accepting
the poorer performance might be less bothersome at times than adjusting your
whole interface for segment iteration.
Caution | |
---|---|
So we advice you to choose element iteration over interval containers judiciously. Do not use element iteration by default or habitual. Always try to achieve results using namespace global functions or operators (preferably inplace versions) or iteration over segments first. |