M
Mirek Fidler
We would like to introduce the NTL, "Nonstandard Template Library", at
www.ntllib.org
NTL is meant as either extension or even replacement for STL. We believe
that NTL provides significantly better productivity and performance over
STL.
NTL was created to solve following problems we used to encounter when
using
STL:
Copy-constructible requirements
---------------------------------
STL requires the elements stored in containers to meet the requirements
of
copy-constructible and assignable types. This causes two problems:
- Elements that do not satisfy these requirements cannot be directly
stored
in STL containers.
- For many types of elements, including STL containers themselves,
copy-constructor and assign operator is a very expensive
operation, that is why often they cannot be stored in STL containers
effectively.
NTL addresses this problem by introducing Vector and Array flavors of
containers (www.ntllib.org/overview.html, www.ntllib.org/moveable.html).
Value transfer
--------------
Content of STL containers can be transfered only using expensive
deep-copy
constructor/assigment operator. This causes performance problems
especially
when using STL containers as function return values, but lack of better
functionality is missing elsewhere too. NTL provides transfer semantics
concepts to deal with this problem. (www.ntllib.org/pick.html)
Random access and random access notation
---------------------------------------------
STL uses iterators as the preferred way how to access and identify
elements
in containers. While this is generally the most generic way, real-life
problems often require or at least benefit from random access using
indices.
NTL provides fast random access to all kinds of containers and NTL
interfaces prefer notation using indices. As a side effect, NTL user can
completely avoid using iterators in favor of indices, which in current
C++
results in much simpler and less verbose syntax (using modern optimizing
compilers there is no difference in performance).
Index
------
A completely new type of associative container, Index, is introduced, as
an
ideal building block for all kinds of associative operations.
(www.ntllib.org/aindex.html)
Algorithm requirements
------------------------
Requirements of STL algorithms are very loosely defined. NTL tries to
provide more specific requirements and also minimal ones. This allows
e.g.
direct sorting of Array of polymorphic elements.
Minor improvements
---------------------
There are also some minor improvements like
- Besides reserve present in STL, NTL provides also Shrink method to
minimize a container's memory consumption.
- Iterators can be assigned a NULL value.
- Associative containers are based on hashing to provide better
performance.
Utility classes and functions are provided to support building correct
hashing functions.
www.ntllib.org
NTL is meant as either extension or even replacement for STL. We believe
that NTL provides significantly better productivity and performance over
STL.
NTL was created to solve following problems we used to encounter when
using
STL:
Copy-constructible requirements
---------------------------------
STL requires the elements stored in containers to meet the requirements
of
copy-constructible and assignable types. This causes two problems:
- Elements that do not satisfy these requirements cannot be directly
stored
in STL containers.
- For many types of elements, including STL containers themselves,
copy-constructor and assign operator is a very expensive
operation, that is why often they cannot be stored in STL containers
effectively.
NTL addresses this problem by introducing Vector and Array flavors of
containers (www.ntllib.org/overview.html, www.ntllib.org/moveable.html).
Value transfer
--------------
Content of STL containers can be transfered only using expensive
deep-copy
constructor/assigment operator. This causes performance problems
especially
when using STL containers as function return values, but lack of better
functionality is missing elsewhere too. NTL provides transfer semantics
concepts to deal with this problem. (www.ntllib.org/pick.html)
Random access and random access notation
---------------------------------------------
STL uses iterators as the preferred way how to access and identify
elements
in containers. While this is generally the most generic way, real-life
problems often require or at least benefit from random access using
indices.
NTL provides fast random access to all kinds of containers and NTL
interfaces prefer notation using indices. As a side effect, NTL user can
completely avoid using iterators in favor of indices, which in current
C++
results in much simpler and less verbose syntax (using modern optimizing
compilers there is no difference in performance).
Index
------
A completely new type of associative container, Index, is introduced, as
an
ideal building block for all kinds of associative operations.
(www.ntllib.org/aindex.html)
Algorithm requirements
------------------------
Requirements of STL algorithms are very loosely defined. NTL tries to
provide more specific requirements and also minimal ones. This allows
e.g.
direct sorting of Array of polymorphic elements.
Minor improvements
---------------------
There are also some minor improvements like
- Besides reserve present in STL, NTL provides also Shrink method to
minimize a container's memory consumption.
- Iterators can be assigned a NULL value.
- Associative containers are based on hashing to provide better
performance.
Utility classes and functions are provided to support building correct
hashing functions.