Skip to content

Commit 6c9e27d

Browse files
tvaneerdzygoloid
authored andcommitted
[sequence.reqmts] Convert advice on container selection into a note.
Also separate out the advice for std::array from that for std::vector and emphasize the main message.
1 parent 7e4b556 commit 6c9e27d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

source/containers.tex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,18 +755,24 @@
755755
might define).
756756

757757
\pnum
758+
\begin{note}
758759
The sequence containers
759760
offer the programmer different complexity trade-offs and should be used
760761
accordingly.
761-
\tcode{vector} or \tcode{array}
762+
\tcode{vector}
762763
is the type of sequence container that should be used by default.
764+
\tcode{array}
765+
should be used when the container has a fixed size known during translation.
763766
\tcode{list} or \tcode{forward_list}
764767
should be used when there are frequent insertions and deletions from the
765768
middle of the sequence.
766769
\tcode{deque}
767770
is the data structure of choice
768771
when most insertions and deletions take place at the beginning or at the
769772
end of the sequence.
773+
When choosing a container, remember \tcode{vector} is best;
774+
leave a comment to explain if you choose from the rest!
775+
\end{note}
770776

771777
\pnum
772778
In Tables~\ref{tab:containers.sequence.requirements}

0 commit comments

Comments
 (0)