List Library C++
List Library C++
List Library C++
ok
Search: Go
Not logged in
C++
1 GUI Virtualization SDK
Information Instantly take your legacy windows applications to the web using our Web enabling SDK Cybelesoft.com
Tutorials
Reference 2 Famous American Singer - Bought This With $5 Millions
Articles A famous american singer-songwriter bought this new toy to her husband as birthday present armadathoughtpark.com
Forum
class template
Reference <list>
C library:
std::list
Containers: template < class T, class Alloc = allocator<T> > class list;
<array> List
<deque> Lists are sequence containers that allow constant time insert and erase operations anywhere within the sequence, and iteration in both
<forward_list> directions.
<list>
<map> List containers are implemented as doubly-linked lists; Doubly linked lists can store each of the elements they contain in different and
<queue> unrelated storage locations. The ordering is kept internally by the association to each element of a link to the element preceding it and a link
<set> to the element following it.
<stack>
They are very similar to forward_list: The main difference being that forward_list objects are single-linked lists, and thus they can only be
<unordered_map> iterated forwards, in exchange for being somewhat smaller and more efficient.
<unordered_set>
<vector> Compared to other base standard sequence containers (array, vector and deque), lists perform generally better in inserting, extracting and
Input/Output: moving elements in any position within the container for which an iterator has already been obtained, and therefore also in algorithms that
Multi-threading: make intensive use of these, like sorting algorithms.
Other:
The main drawback of lists and forward_lists compared to these other sequence containers is that they lack direct access to the elements
<list> by their position; For example, to access the sixth element in a list, one has to iterate from a known position (like the beginning or the end)
to that position, which takes linear time in the distance between these. They also consume some extra memory to keep the linking
list
information associated to each element (which may be an important factor for large lists of small-sized elements).
list
list::list Container properties
list::~list
member functions: Sequence
list::assign Elements in sequence containers are ordered in a strict linear sequence. Individual elements are accessed by their position in this
list::back sequence.
list::begin Doubly-linked list
list::cbegin Each element keeps information on how to locate the next and the previous elements, allowing constant time insert and erase
list::cend operations before or after a specific element (even of entire ranges), but no direct random access.
list::clear Allocator-aware
list::crbegin The container uses an allocator object to dynamically handle its storage needs.
list::crend
list::emplace
list::emplace_back Template parameters
list::emplace_front
list::empty T
list::end Type of the elements.
list::erase Aliased as member type list::value_type.
list::front Alloc
list::get_allocator Type of the allocator object used to define the storage allocation model. By default, the allocator class template is used, which
list::insert defines the simplest memory allocation model and is value-independent.
list::max_size Aliased as member type list::allocator_type.
list::merge
list::operator=
list::pop_back Member types
list::pop_front
list::push_back C++98 C++11
list::push_front member type definition notes
list::rbegin
value_type The first template parameter (T)
list::remove
defaults to:
list::remove_if allocator_type The second template parameter (Alloc)
allocator<value_type>
list::rend
for the default allocator:
list::resize reference allocator_type::reference
value_type&
list::reverse for the default allocator: const
list::size const_reference allocator_type::const_reference
value_type&
list::sort for the default allocator:
list::splice pointer allocator_type::pointer
value_type*
list::swap for the default allocator: const
list::unique
const_pointer allocator_type::const_pointer
value_type*
non-member overloads: iterator a bidirectional iterator to value_type convertible to const_iterator
relational operators (list) const_iterator a bidirectional iterator to const value_type
swap (list) reverse_iterator reverse_iterator<iterator>
const_reverse_iterator reverse_iterator<const_iterator>
a signed integral type, identical to:
difference_type usually the same as ptrdiff_t
iterator_traits<iterator>::difference_type
size_type an unsigned integral type that can represent any non-negative value of usually the same as size_t
difference_type
Member functions
(constructor) Construct list (public member function )
(destructor) List destructor (public member function )
operator= Assign content (public member function )
Iterators:
begin Return iterator to beginning (public member function )
end Return iterator to end (public member function )
rbegin Return reverse iterator to reverse beginning (public member function )
rend Return reverse iterator to reverse end (public member function )
cbegin Return const_iterator to beginning (public member function )
cend Return const_iterator to end (public member function )
crbegin Return const_reverse_iterator to reverse beginning (public member function )
crend Return const_reverse_iterator to reverse end (public member function )
Capacity:
empty Test whether container is empty (public member function )
size Return size (public member function )
max_size Return maximum size (public member function )
Element access:
front Access first element (public member function )
back Access last element (public member function )
Modifiers:
assign Assign new content to container (public member function )
emplace_front Construct and insert element at beginning (public member function )
push_front Insert element at beginning (public member function )
pop_front Delete first element (public member function )
emplace_back Construct and insert element at the end (public member function )
push_back Add element at the end (public member function )
pop_back Delete last element (public member function )
emplace Construct and insert element (public member function )
insert Insert elements (public member function )
erase Erase elements (public member function )
swap Swap content (public member function )
resize Change size (public member function )
clear Clear content (public member function )
Operations:
splice Transfer elements from list to list (public member function )
remove Remove elements with specific value (public member function )
remove_if Remove elements fulfilling condition (public member function template )
unique Remove duplicate values (public member function )
merge Merge sorted lists (public member function )
sort Sort elements in container (public member function )
reverse Reverse the order of elements (public member function )
Observers:
get_allocator Get allocator (public member function )