|
31 | 31 | \end{libsumtab}
|
32 | 32 |
|
33 | 33 |
|
34 |
| -\rSec1[container.requirements]{Container requirements}% |
| 34 | +\rSec1[container.requirements]{Requirements}% |
35 | 35 | \indextext{requirements!container}
|
36 | 36 |
|
37 |
| -\rSec2[container.requirements.general]{General container requirements} |
| 37 | +\rSec2[container.requirements.pre]{Preamble} |
38 | 38 |
|
39 | 39 | \pnum
|
40 | 40 | Containers are objects that store other objects.
|
|
54 | 54 | \end{example}
|
55 | 55 |
|
56 | 56 | \pnum
|
57 |
| -Allocator-aware containers (\tref{container.alloc.req}) |
| 57 | +Allocator-aware containers\iref{container.alloc.reqmts} |
58 | 58 | other than \tcode{basic_string} construct elements using the function
|
59 | 59 | \tcode{allocator_traits<allocator_type>::rebind_traits<U>::\brk{}construct}
|
60 | 60 | and destroy elements using the function
|
|
69 | 69 | aligned buffers and call \tcode{construct} to place the element into the buffer.
|
70 | 70 | \end{note}
|
71 | 71 |
|
| 72 | +\rSec2[container.gen.reqmts]{General containers} |
| 73 | + |
| 74 | +\rSec3[container.requirements.general]{General} |
| 75 | + |
72 | 76 | \pnum
|
73 |
| -In this subclause, |
| 77 | +In subclause \ref{container.gen.reqmts}, |
74 | 78 | \begin{itemize}
|
75 | 79 | \item
|
76 | 80 | \tcode{X} denotes a container class containing objects of type \tcode{T},
|
|
86 | 90 | \tcode{rv} denotes a non-const rvalue of type \tcode{X}.
|
87 | 91 | \end{itemize}
|
88 | 92 |
|
| 93 | +\rSec3[container.reqmts]{Containers} |
| 94 | + |
89 | 95 | \pnum
|
90 | 96 | A type \tcode{X} meets the \defn{container} requirements
|
91 | 97 | if the following types, statements, and expressions are well-formed and
|
|
584 | 590 | with value \tcode{a.end()} before the swap will have value \tcode{b.end()} after the
|
585 | 591 | swap.
|
586 | 592 |
|
| 593 | +\rSec3[container.rev.reqmts]{Reversible container requirements} |
| 594 | + |
587 | 595 | \pnum
|
588 | 596 | A type \tcode{X} meets the \defnadj{reversible}{container} requirements if
|
589 | 597 | \tcode{X} meets the container requirements,
|
|
748 | 756 | \oldconcept{RandomAccessIterator} requirements\iref{random.access.iterators} and
|
749 | 757 | model \libconcept{contiguous_iterator}\iref{iterator.concept.contiguous}.
|
750 | 758 |
|
| 759 | +\rSec3[container.opt.reqmts]{Optional container requirements} |
| 760 | + |
751 | 761 | \pnum
|
752 | 762 | The following operations are provided
|
753 | 763 | for some types of containers but not others. Those containers for which the
|
|
787 | 797 | Linear.
|
788 | 798 | \end{itemdescr}
|
789 | 799 |
|
| 800 | +\rSec3[container.alloc.reqmts]{Allocator-aware containers} |
| 801 | + |
790 | 802 | \pnum
|
791 | 803 | All of the containers defined in \ref{containers} and in~\ref{basic.string} except \tcode{array}
|
792 | 804 | meet the additional requirements of an \defnadj{allocator-aware}{container},
|
|
1993 | 2005 | template<@\unspecnc@>
|
1994 | 2006 | class @\placeholder{node-handle}@ {
|
1995 | 2007 | public:
|
1996 |
| - // These type declarations are described in Tables \ref{tab:container.assoc.req} and \ref{tab:container.hash.req}. |
| 2008 | + // These type declarations are described in \ref{associative.reqmts} and \ref{unord.req}. |
1997 | 2009 | using value_type = @\seebelownc{}@; // not present for map containers
|
1998 | 2010 | using key_type = @\seebelownc{}@; // not present for set containers
|
1999 | 2011 | using mapped_type = @\seebelownc{}@; // not present for set containers
|
|
2425 | 2437 | have the specified semantics,
|
2426 | 2438 | except that for
|
2427 | 2439 | \tcode{map} and \tcode{multimap}, the requirements placed on \tcode{value_type}
|
2428 |
| -in \tref{container.alloc.req} apply instead to \tcode{key_type} |
| 2440 | +in \ref{container.alloc.reqmts} apply instead to \tcode{key_type} |
2429 | 2441 | and \tcode{mapped_type}.
|
2430 | 2442 | \begin{note}
|
2431 | 2443 | For example, in some cases \tcode{key_type} and \tcode{mapped_type}
|
|
3846 | 3858 | the following types, statements, and expressions are well-formed and
|
3847 | 3859 | have the specified semantics,
|
3848 | 3860 | except that for \tcode{unordered_map} and \tcode{unordered_multimap},
|
3849 |
| -the requirements placed on \tcode{value_type} in \tref{container.alloc.req} |
| 3861 | +the requirements placed on \tcode{value_type} in \ref{container.alloc.reqmts} |
3850 | 3862 | apply instead to \tcode{key_type} and \tcode{mapped_type}.
|
3851 | 3863 | \begin{note}
|
3852 | 3864 | For example, \tcode{key_type} and \tcode{mapped_type}
|
|
5676 | 5688 |
|
5677 | 5689 | \pnum
|
5678 | 5690 | \indextext{requirements!container}%
|
5679 |
| -An \tcode{array} meets all of the requirements of a container and |
5680 |
| -of a reversible container\iref{container.requirements}, except that a default |
| 5691 | +An \tcode{array} meets all of the requirements |
| 5692 | +of a container\iref{container.reqmts} and |
| 5693 | +of a reversible container\iref{container.rev.reqmts}, |
| 5694 | +except that a default |
5681 | 5695 | constructed \tcode{array} object is not empty and that \tcode{swap} does not have constant
|
5682 | 5696 | complexity. An \tcode{array} meets some of the requirements of a sequence
|
5683 | 5697 | container\iref{sequence.reqmts}.
|
|
5991 | 6005 | Storage management is handled automatically.
|
5992 | 6006 |
|
5993 | 6007 | \pnum
|
5994 |
| -A |
5995 |
| -\tcode{deque} |
5996 |
| -meets all of the requirements of a container, of a reversible container |
5997 |
| -(given in tables in~\ref{container.requirements}), of a sequence container, |
5998 |
| -including the optional sequence container requirements\iref{sequence.reqmts}, and of an allocator-aware container (\tref{container.alloc.req}). |
| 6008 | +A \tcode{deque} meets all of the requirements |
| 6009 | +of a container\iref{container.reqmts}, |
| 6010 | +of a reversible container\iref{container.rev.reqmts}, |
| 6011 | +of an allocator-aware container\iref{container.alloc.reqmts}, and |
| 6012 | +of a sequence container, |
| 6013 | +including the optional sequence container requirements\iref{sequence.reqmts}. |
5999 | 6014 | Descriptions are provided here only for operations on
|
6000 | 6015 | \tcode{deque}
|
6001 | 6016 | that are not described in one of these tables
|
|
6407 | 6422 | \end{note}
|
6408 | 6423 |
|
6409 | 6424 | \pnum
|
6410 |
| -A \tcode{forward_list} meets all of the requirements of a container\iref{container.requirements.general}, except that the \tcode{size()} |
6411 |
| -member function is not provided and \tcode{operator==} has linear complexity. |
6412 |
| -A \tcode{forward_list} also meets all of the requirements for an allocator-aware |
6413 |
| -container (\tref{container.alloc.req}). In addition, a \tcode{forward_list} |
6414 |
| -provides the \tcode{assign} member functions |
6415 |
| -(\tref{container.seq.req}) and several of the optional |
6416 |
| -container requirements (\tref{container.seq.opt}). |
| 6425 | +A \tcode{forward_list} meets all of the requirements |
| 6426 | +of a container\iref{container.reqmts}, |
| 6427 | +except that the \tcode{size()} member function is not provided and |
| 6428 | +\tcode{operator==} has linear complexity, |
| 6429 | +A \tcode{forward_list} also meets all of the requirements |
| 6430 | +for an allocator-aware container\iref{container.alloc.reqmts}. |
| 6431 | +In addition, a \tcode{forward_list} |
| 6432 | +provides the \tcode{assign} member functions and |
| 6433 | +several of the optional sequence container requirements\iref{sequence.reqmts}. |
6417 | 6434 | Descriptions are provided here only for operations on
|
6418 | 6435 | \tcode{forward_list} that are not described in that table or for operations where there
|
6419 | 6436 | is additional semantic information.
|
|
7207 | 7224 | algorithms only need sequential access anyway.
|
7208 | 7225 |
|
7209 | 7226 | \pnum
|
7210 |
| -A \tcode{list} meets all of the requirements of a container, of |
7211 |
| -a reversible container (given in two tables in |
7212 |
| -\ref{container.requirements}), of a sequence container, |
| 7227 | +A \tcode{list} meets all of the requirements |
| 7228 | +of a container\iref{container.reqmts}, |
| 7229 | +of a reversible container\iref{container.rev.reqmts}, |
| 7230 | +of an allocator-aware container\iref{container.alloc.reqmts}, and |
| 7231 | +of a sequence container, |
7213 | 7232 | including most of the optional sequence container
|
7214 |
| -requirements\iref{sequence.reqmts}, and of an allocator-aware container |
7215 |
| -(\tref{container.alloc.req}). |
| 7233 | +requirements\iref{sequence.reqmts}. |
7216 | 7234 | The exceptions are the
|
7217 | 7235 | \tcode{operator[]}
|
7218 | 7236 | and
|
|
7919 | 7937 | to improve efficiency.
|
7920 | 7938 |
|
7921 | 7939 | \pnum
|
7922 |
| -A \tcode{vector} meets all of the requirements of a container and of a |
7923 |
| -reversible container (given in two tables in~\ref{container.requirements}), of a |
7924 |
| -sequence container, including most of the optional sequence container |
7925 |
| -requirements\iref{sequence.reqmts}, of an allocator-aware container |
7926 |
| -(\tref{container.alloc.req}), |
| 7940 | +A \tcode{vector} meets all of the requirements |
| 7941 | +of a container\iref{container.reqmts}, |
| 7942 | +of a reversible container\iref{container.rev.reqmts}, |
| 7943 | +of an allocator-aware container\iref{container.alloc.reqmts}, |
| 7944 | +of a sequence container, including most of the optional sequence container |
| 7945 | +requirements\iref{sequence.reqmts}, |
7927 | 7946 | and, for an element type other than \tcode{bool},
|
7928 | 7947 | of a contiguous container\iref{container.requirements.general}.
|
7929 | 7948 | The exceptions are the
|
|
8798 | 8817 | on the keys. The \tcode{map} class supports bidirectional iterators.
|
8799 | 8818 |
|
8800 | 8819 | \pnum
|
8801 |
| -A |
8802 |
| -\tcode{map} |
8803 |
| -meets all of the requirements of a container, of a reversible container\iref{container.requirements}, of |
8804 |
| -an associative container\iref{associative.reqmts}, and of an allocator-aware container (\tref{container.alloc.req}). |
| 8820 | +A \tcode{map} meets all of the requirements of |
| 8821 | +a container\iref{container.reqmts}, |
| 8822 | +of a reversible container\iref{container.rev.reqmts}, |
| 8823 | +of an allocator-aware container\iref{container.alloc.reqmts}. and |
| 8824 | +of an associative container\iref{associative.reqmts}. |
8805 | 8825 | A
|
8806 | 8826 | \tcode{map}
|
8807 | 8827 | also provides most operations described in~\ref{associative.reqmts}
|
|
9345 | 9365 | supports bidirectional iterators.
|
9346 | 9366 |
|
9347 | 9367 | \pnum
|
9348 |
| -A |
9349 |
| -\tcode{multimap} meets all of the requirements of a container and of a |
9350 |
| -reversible container\iref{container.requirements}, of an associative |
9351 |
| -container\iref{associative.reqmts}, and of an allocator-aware container |
9352 |
| -(\tref{container.alloc.req}). |
| 9368 | +A \tcode{multimap} meets all of the requirements |
| 9369 | +of a container\iref{container.reqmts}, |
| 9370 | +of a reversible container\iref{container.rev.reqmts}, |
| 9371 | +of an allocator-aware container\iref{container.alloc.reqmts}, and |
| 9372 | +of an associative container\iref{associative.reqmts}. |
9353 | 9373 | A
|
9354 | 9374 | \tcode{multimap}
|
9355 | 9375 | also provides most operations described in~\ref{associative.reqmts}
|
|
9666 | 9686 | supports bidirectional iterators.
|
9667 | 9687 |
|
9668 | 9688 | \pnum
|
9669 |
| -A \tcode{set} meets all of the requirements of a container, of a reversible |
9670 |
| -container\iref{container.requirements}, of an associative |
9671 |
| -container\iref{associative.reqmts}, and of an allocator-aware container |
9672 |
| -(\tref{container.alloc.req}). |
| 9689 | +A \tcode{set} meets all of the requirements |
| 9690 | +of a container\iref{container.reqmts}, |
| 9691 | +of a reversible container\iref{container.rev.reqmts}, |
| 9692 | +of an allocator-aware container\iref{container.alloc.reqmts}. and |
| 9693 | +of an associative container\iref{associative.reqmts}. |
9673 | 9694 | A
|
9674 | 9695 | \tcode{set}
|
9675 | 9696 | also provides most operations described in~\ref{associative.reqmts}
|
|
9944 | 9965 | supports bidirectional iterators.
|
9945 | 9966 |
|
9946 | 9967 | \pnum
|
9947 |
| -A \tcode{multiset} meets all of the requirements of a container, of a |
9948 |
| -reversible container\iref{container.requirements}, of an associative |
9949 |
| -container\iref{associative.reqmts}, and of an allocator-aware container |
9950 |
| -(\tref{container.alloc.req}). |
| 9968 | +A \tcode{multiset} meets all of the requirements |
| 9969 | +of a container\iref{container.reqmts}, |
| 9970 | +of a reversible container\iref{container.rev.reqmts}, |
| 9971 | +of an allocator-aware container\iref{container.alloc.reqmts}, |
| 9972 | +of an associative container\iref{associative.reqmts}. |
9951 | 9973 | \tcode{multiset}
|
9952 | 9974 | also provides most operations described in~\ref{associative.reqmts}
|
9953 | 9975 | for duplicate keys.
|
|
10375 | 10397 | supports forward iterators.
|
10376 | 10398 |
|
10377 | 10399 | \pnum
|
10378 |
| -An \tcode{unordered_map} meets all of the requirements of a container, of an unordered associative container, and of an allocator-aware container (\tref{container.alloc.req}). It provides the operations described in the preceding requirements table for unique keys; that is, an \tcode{unordered_map} supports the \tcode{a_uniq} operations in that table, not the \tcode{a_eq} operations. For an \tcode{unordered_map<Key, T>} the \tcode{key type} is \tcode{Key}, the mapped type is \tcode{T}, and the value type is \tcode{pair<const Key, T>}. |
| 10400 | +An \tcode{unordered_map} meets all of the requirements |
| 10401 | +of a container\iref{container.reqmts}, |
| 10402 | +of an allocator-aware container\iref{container.alloc.reqmts}, and |
| 10403 | +of an unordered associative container\iref{unord.req}. |
| 10404 | +It provides the operations described in the preceding requirements table for unique keys; that is, an \tcode{unordered_map} supports the \tcode{a_uniq} operations in that table, not the \tcode{a_eq} operations. For an \tcode{unordered_map<Key, T>} the \tcode{key type} is \tcode{Key}, the mapped type is \tcode{T}, and the value type is \tcode{pair<const Key, T>}. |
10379 | 10405 |
|
10380 | 10406 | \pnum
|
10381 | 10407 | Subclause~\ref{unord.map} only describes operations on \tcode{unordered_map} that
|
|
10967 | 10993 | supports forward iterators.
|
10968 | 10994 |
|
10969 | 10995 | \pnum
|
10970 |
| -An \tcode{unordered_multimap} meets all of the requirements of a container, of an |
10971 |
| -unordered associative container, and of an allocator-aware container |
10972 |
| -(\tref{container.alloc.req}). It provides the operations described in the |
| 10996 | +An \tcode{unordered_multimap} meets all of the requirements |
| 10997 | +of a container\iref{container.reqmts}, |
| 10998 | +of an allocator-aware container\iref{container.alloc.reqmts}, and |
| 10999 | +of an unordered associative container\iref{unord.req}. |
| 11000 | +It provides the operations described in the |
10973 | 11001 | preceding requirements table for equivalent keys; that is, an \tcode{unordered_multimap}
|
10974 | 11002 | supports the \tcode{a_eq} operations in that table, not the \tcode{a_uniq} operations.
|
10975 | 11003 | For an \tcode{unordered_multimap<Key, T>} the \tcode{key type} is \tcode{Key}, the
|
|
11343 | 11371 | supports forward iterators.
|
11344 | 11372 |
|
11345 | 11373 | \pnum
|
11346 |
| -An \tcode{unordered_set} meets all of the requirements of a container, of an unordered associative container, and of an allocator-aware container (\tref{container.alloc.req}). It provides the operations described in the preceding requirements table for unique keys; that is, an \tcode{unordered_set} supports the \tcode{a_uniq} operations in that table, not the \tcode{a_eq} operations. For an \tcode{unordered_set<Key>} the \tcode{key type} and the value type are both \tcode{Key}. The \tcode{iterator} and \tcode{const_iterator} types are both constant iterator types. It is unspecified whether they are the same type. |
| 11374 | +An \tcode{unordered_set} meets all of the requirements |
| 11375 | +of a container\iref{container.reqmts}, |
| 11376 | +of an allocator-aware container\iref{container.alloc.reqmts}, |
| 11377 | +of an unordered associative container\iref{unord.req}. |
| 11378 | +It provides the operations described in the preceding requirements table for unique keys; that is, an \tcode{unordered_set} supports the \tcode{a_uniq} operations in that table, not the \tcode{a_eq} operations. For an \tcode{unordered_set<Key>} the \tcode{key type} and the value type are both \tcode{Key}. The \tcode{iterator} and \tcode{const_iterator} types are both constant iterator types. It is unspecified whether they are the same type. |
11347 | 11379 |
|
11348 | 11380 | \pnum
|
11349 | 11381 | Subclause~\ref{unord.set} only describes operations on \tcode{unordered_set} that
|
|
11664 | 11696 | supports forward iterators.
|
11665 | 11697 |
|
11666 | 11698 | \pnum
|
11667 |
| -An \tcode{unordered_multiset} meets all of the requirements of a container, of an |
11668 |
| -unordered associative container, and of an allocator-aware container |
11669 |
| -(\tref{container.alloc.req}). It provides the operations described in the |
| 11699 | +An \tcode{unordered_multiset} meets all of the requirements |
| 11700 | +of a container\iref{container.reqmts}, |
| 11701 | +of an allocator-aware container\iref{container.alloc.reqmts}, and |
| 11702 | +of an unordered associative container\iref{unord.req}. |
| 11703 | +It provides the operations described in the |
11670 | 11704 | preceding requirements table for equivalent keys; that is, an \tcode{unordered_multiset}
|
11671 | 11705 | supports the \tcode{a_eq} operations in that table, not the \tcode{a_uniq} operations.
|
11672 | 11706 | For an \tcode{unordered_multiset<Key>} the \tcode{key type} and the value type are
|
|
0 commit comments