Standard Template Library: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica
Nessun oggetto della modifica
Riga 7:
 
La Standard Template Library è stata la prima libreria a contenere algoritmi e strutture dati generici, seguendo quattro concetti base: programmazione generica, astrattezza senza perdita di efficienza, il [[Architettura di von Neumann|modello computazionale di Von Neumann]], and value semantics.
 
 
==Contents==
===Containers===
The STL contains sequence containers and associative containers. The standard sequence containers include ''vector'', ''string'' and ''deque''. The standard [[associative array|associative containers]] are ''set'', ''multiset'', ''map'' and ''multimap''.
 
'''vector''' - is a C-like [[array]] (i.e. capable of random access) with the ability to automatically resize itself when inserting or erasing an object. Inserting and removing an element to/from back of the vector at the end takes constant time. Inserting and erasing at the beginning or in the middle is linear in time.
 
'''deque''' (''double ended [[queue]]'') - a vector with insertion/erase at the beginning in amortized constant time, however lacking some guarantees on iterator validity after altering the deque.
 
'''set''' - inserting/erasing elements in a set does not invalidate iterators pointing in the set. Provides set operations [[union (set theory) | union]], [[intersection (set theory) | intersection]], difference, [[symmetric difference]] and test of inclusion.
 
Libraries implementing STL often include [[hash table | hashed]] variants: ''hash_set'', ''hash_multiset'', ''hash_map'' and ''hash_multimap'', however this extension is not part of standard and are defined in various [[namespace]]s among implementations as a result.
 
===Iterators===
The STL implements five different types of iterators. These are ''input iterators'', ''output iterators'', ''forward iterators'', ''bidirectional iterators'' and ''random access iterators''.
 
===Functors===
The STL includes classes that overload the function operator (operator()). Classes that do this are called functor classes or [[function object|function classes]]. They are useful for keeping and retrieving state information in functions passed into other functions.
 
==Storia==
Riga 27 ⟶ 46:
 
The prospects for early widespread dissemination of STL were considerably improved with Hewlett-Packard's decision to make its implementation freely available on the [[Internet]] in August 1994. This implementation, developed by Stepanov, Lee, and Musser during the standardization process, became the basis of all implementations offered by compiler and library vendors today.
 
==Contents==
===Containers===
The STL contains sequence containers and associative containers. The standard sequence containers include ''vector'', ''string'' and ''deque''. The standard [[associative array|associative containers]] are ''set'', ''multiset'', ''map'' and ''multimap''.
 
'''vector''' - is a C-like [[array]] (i.e. capable of random access) with the ability to automatically resize itself when inserting or erasing an object. Inserting and removing an element to/from back of the vector at the end takes constant time. Inserting and erasing at the beginning or in the middle is linear in time.
 
'''deque''' (''double ended [[queue]]'') - a vector with insertion/erase at the beginning in amortized constant time, however lacking some guarantees on iterator validity after altering the deque.
 
'''set''' - inserting/erasing elements in a set does not invalidate iterators pointing in the set. Provides set operations [[union (set theory) | union]], [[intersection (set theory) | intersection]], difference, [[symmetric difference]] and test of inclusion.
 
Libraries implementing STL often include [[hash table | hashed]] variants: ''hash_set'', ''hash_multiset'', ''hash_map'' and ''hash_multimap'', however this extension is not part of standard and are defined in various [[namespace]]s among implementations as a result.
 
===Iterators===
The STL implements five different types of iterators. These are ''input iterators'', ''output iterators'', ''forward iterators'', ''bidirectional iterators'' and ''random access iterators''.
 
===Functors===
The STL includes classes that overload the function operator (operator()). Classes that do this are called functor classes or [[function object|function classes]]. They are useful for keeping and retrieving state information in functions passed into other functions.
 
==References==