Are sequence containers not a subset of general containers?

Discussion in 'C++' started by Sebastian Mach, Oct 5, 2012.

  1. `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)
    Sebastian Mach, Oct 5, 2012
    #1
    1. Advertising

  2. On 10/5/2012 6:42 AM, Sebastian Mach wrote:
    > `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?

    >> 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?


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

    V
    --
    I do not respond to top-posted replies, please don't ask
    Victor Bazarov, Oct 5, 2012
    #2
    1. Advertising

  3. Sebastian Mach

    Guest

    On Friday, 5 October 2012 12:55:43 UTC+1, Victor Bazarov wrote:

    > 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.
    , Oct 5, 2012
    #3
  4. Sebastian Mach

    Guest

    On Friday, 5 October 2012 13:18:55 UTC+1, wrote:
    > On Friday, 5 October 2012 12:55:43 UTC+1, Victor Bazarov wrote:
    >
    >
    >
    > > 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.


    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.
    , Oct 5, 2012
    #4
  5. Sebastian Mach

    Guest

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



    This wording was my conclusion. I misformatted that one. Sorry.
    , Oct 5, 2012
    #5
  6. Sebastian Mach

    Guest

    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
    , Oct 6, 2012
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guoqi Zheng

    subset of data using dataview??

    Guoqi Zheng, Jan 19, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,998
    Miha Markic
    Jan 19, 2004
  2. Andy
    Replies:
    0
    Views:
    407
  3. Oliver Dain

    C is not a subset of C++?

    Oliver Dain, Sep 1, 2003, in forum: C++
    Replies:
    5
    Views:
    771
    Default User
    Sep 3, 2003
  4. stef mientki
    Replies:
    13
    Views:
    622
    stef mientki
    Oct 20, 2007
  5. Replies:
    7
    Views:
    540
    Pete Becker
    Jan 25, 2008
Loading...

Share This Page