| Home | C++ Development | Website Development | Tree Container Library | Work Time Studio |
|---|
Versions 3.50 and later are compatible with the STL. What this means is that you can use STL container iterators in some operations in the TCL, and also use both TCL child iterators and descendant iterators with STL algorithms and containers. The following list shows just some of the operations you can perform between the STL and TCL.
STL compatibility is made possible by deriving the TCL iterators from the proper STL iterator type. Iterators derived from an appropriate STL iterator type, which also define the appropriate required set of operations, can be used in the STL algorithms. The list below, show how the various iterators are derived. Note that the iterators expose the underlying node's element as seen in all of the derivation declarations below. Since all iterators expose the element of the underlying node, any operations performed by STL algorithms will be on the element of the underlying node, not on the node itself. This is an important concept, and will be illustrated in the examples. The list below show how the various TCL iterators are derived.
std::iterator<std::bidirectional_iterator_tag, stored_type>
std::iterator<std::random_access_iterator_tag, stored_type>
std::iterator<std::bidirectional_iterator_tag, stored_type>
std::iterator<std::forward_iterator_tag, stored_type>
std::iterator<std::bidirectional_iterator_tag, stored_type>
STL compatibility involves not only the TCL iterators, but the TCL containers as well. In order to be compatible with the STL, the TCL containers must define a required set of operations. These requirements differ between associative containers and sequential containers. Thus, there are different container requirements for the associative tree containers, and for sequential_tree. Furthermore, certain typdefs must be declared for both the STL containers and iterators for them to be compatible with the STL. The latest version of the TCL fulfills all these requirements, which make all the TCL containers and iterators compatible with the containers, iterators, and algorithms in the STL.
The following pages illustrate how you can use the TCL in conjunction with the STL. To see some live examples of how the TCL and STL work together, you can also download the TCL test suite, which provides tests on every facet of the TCL, including STL compatibility tests. Since this test suite is a work in progress, check back often to obtain the latest test cases within the suite.