Are sequence containers not a subset of general containers?

S

Sebastian Mach

`stack` does not have an `iterator`-member-type, and therefore does not meet the general container requirements: `[container.requirements.general]`.


But in `[container.adaptors.general]`
The headers <queue> and <stack> define the container adaptors queue, priority_queue, and stack. These
container adaptors meet the requirements for sequence containers.


Are sequence containers not a subset of general containers?


(sidenote: I originally asked this on http://stackoverflow.com/questions/...containers-not-a-subset-of-general-containers)
 
V

Victor Bazarov

`stack` does not have an `iterator`-member-type, and therefore does
not meet the general container requirements:
`[container.requirements.general]`.
I can't find that wording anywhere. What document are you looking at?
But in `[container.adaptors.general]`

Is that from the final C++ 2011 Standard or one of the later drafts?
container adaptors meet the requirements for sequence containers.


Are sequence containers not a subset of general containers?

<shrug> Could it be you're looking at a defective draft that has been
superseded already?

V
 
S

steve.jessop

I can't find that wording anywhere. What document are you looking at?

The text is in N3290 (the FDIS) and also in N3337, which is the last draft I have. Was there much editorial change between N3337 and the ISO standard?

Steve.
 
S

sftrabbit

The text is in N3290 (the FDIS) and also in N3337, which is the last draft I have. Was there much editorial change between N3337 and the ISO standard?



Steve.

Looking at the draft on github, the defect still appears.

[container.adaptors.general] says: "The headers <queue> and <stack> define the container adaptors queue, priority_queue, and stack. These container adaptors meet the requirements for sequence containers." So stack should meetthe requirements for sequence containers.

Table 100, which gives those requirements, is captioned as: "Sequence container requirements (in addition to container)." So stack should meet container requirements too.

Container requirements (Table 96) require, for example, the expression X::iterator to be a valid type member of container X. However, the definition of stack in [stack.defn] does not provide stack::iterator. Therefore, the original statement (that stack is a sequence container) is false.

The same is true for both priority_queue and queue.
 
M

mach.seb

I can't find that wording anywhere. What document are you looking at?

This wording was my conclusion. I misformatted that one. Sorry.
 
M

mach.seb

Am Freitag, 5. Oktober 2012 12:42:28 UTC+2 schrieb Sebastian Mach:
`stack` does not have an `iterator`-member-type, and therefore does not meet the general container requirements: `[container.requirements.general]`.





But in `[container.adaptors.general]`


The headers <queue> and <stack> define the container adaptors queue, priority_queue, and stack. These

container adaptors meet the requirements for sequence containers.





Are sequence containers not a subset of general containers?





(sidenote: I originally asked this on http://stackoverflow.com/questions/...containers-not-a-subset-of-general-containers)

This is a defect that is now taken care of: http://cplusplus.github.com/LWG/lwg-active.html#2194
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top