~ubuntu-branches/ubuntu/trusty/c++-annotations/trusty-proposed

« back to all changes in this revision

Viewing changes to yo/containers/container.yo

  • Committer: Package Import Robot
  • Author(s): Frank B. Brokken
  • Date: 2013-05-30 13:32:18 UTC
  • mfrom: (1.1.24)
  • Revision ID: package-import@ubuntu.com-20130530133218-k39mr5uredd093jr
Tags: 9.7.2-1
New upstream release, repairs several minor left-over flaws.
This release incorporates 9.7.0 and 9.7.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 
40
40
Most of the abstract containers are em(sequential) containers: they contain
41
41
data that can be stored and retrieved in some sequential
42
 
way. Examples are the ti(vector), implementing an i(extendable array); the
43
 
ti(list), implementing a datastructure that allows for the easy insertion or
44
 
deletion of  data the ti(queue), also called a emi(FIFO)
 
42
way. Examples are the tt(array), implementing a fixed-sized array; a 
 
43
tt(vector), implementing an extendable array; the
 
44
tt(list), implementing a data structure that allows for the easy insertion or
 
45
deletion of  data; the tt(queue), also called a emi(FIFO)
45
46
    (i(first in, first out)) structure, in which the first element that is
46
 
entered is the first element to be retrieved again; and the ti(stack),
 
47
entered is the first element to be retrieved again; and the tt(stack),
47
48
which is a
48
49
    emi(first in, last out) (i(FILO) or i(LIFO)) structure.
49
50
 
50
 
In addition to sequential containers several i(special containers) are
 
51
In addition to sequential containers several special containers are
51
52
available. The tt(pair) is a basic container in which a pair of values (of
52
53
types that are left open for further specification) can be stored, like two
53
54
strings, two ints, a string and a double, etc.. Pairs are often used to return
54
 
data elements that naturally come in pairs. For example, the ti(map) is an
 
55
data elements that naturally come in pairs. For example, the tt(map) is an
55
56
abstract container storing keys and their associated values. Elements
56
57
of these maps are returned as tt(pairs).
57
58
 
58
 
A variant of the tt(pair) is the hi(complex container) tt(complex) container,
59
 
implementing operations that are defined on emi(complex numbers).
 
59
A variant of the tt(pair) is the tt(complex) container, implementing
 
60
operations that are defined on complex numbers.
 
61
 
 
62
A tt(tuple) (cf. section ref(TUPLES)) generalizes the tt(pair) container to a
 
63
data structure accomodating any number of different data types.
60
64
 
61
65
All abstract containers described in this chapter as well as the tt(string)
62
66
and stream datatypes (cf. chapters ref(String) and ref(IOStreams)) are part of
69
73
    the following basic set of operators:
70
74
    itemization(
71
75
    it() The i(overloaded assignment) operator, so we can assign two
72
 
containers of the same types to each other. This basic operator em(is)
 
76
containers of the same types to each other. If the container's data type
 
77
supports move assignment, then assignment of an anonymous temporary container
 
78
to a destination container will use move assignment when assigning new values
 
79
to the destination container's element. Overloaded assignment is em(also)
73
80
supported by the unordered containers;
74
81
    it() hi(containers: equality tests) Tests for equality: ti(==) and ti(!=)
75
82
The i(equality operator) applied to two containers returns tt(true) if the two
108
115
ref(QUEUE)) containers) support members to determine their maximum sizes
109
116
(through their member function i(max_size)).
110
117
 
 
118
    Virtually all containers support copy construction.  If the container
 
119
supports copy construction and the container's data type supports move
 
120
construction, then move construction is automatically used for the container's
 
121
data elements when a container is initialized with an anonymous temporary
 
122
container.
 
123
 
111
124
    Closely linked to the standard template library are the
112
125
    emi(generic algorithms). These algorithms may be used to perform
113
126
frequently occurring tasks or more complex tasks than is possible with the