Are sequence containers not a subset of shared containers?

stack not of type iterator -member and therefore does not meet the general requirements for a container: [container.requirements.general] .

But in [container.adaptors.general]

The headers <queue> and <stack> define the container adapters queue , priority_queue and stack . These container adapters meet the requirements for sequence containers.

Are sequence containers not a subset of shared containers?

+4
source share
2 answers

This is really a defect ( http://cplusplus.github.com/LWG/lwg-active.html#2194 ):

Since containers for sequences are a subset of common containers, this imposes requirements on container adapters that are not met. [...] As NB noted, adapters are really not sequences and containers, so this wording needs to be fixed. The easiest way to understand this is to harm the sentence.

+1
source

Sequence containers are a subset of the common containers.

However, sequence adapters do not satisfy the requirements specific to sequence containers (there are no insert member functions), and, as you have noticed, also do not meet the general requirements for containers. I don’t think that [container.adaptors.general] should say that they do it, but he says that in C ++ 11 I have drafts.

+1
source

Source: https://habr.com/ru/post/1437969/


All Articles