question about stacks (and vectors too for that matter)

This is a discussion on question about stacks (and vectors too for that matter) within the C++ Programming forums, part of the General Programming Boards category; How come I can have: stack<int> List; but when I do the following i get errors: stack<stack<int>> List; I want ...

  1. #1
    Banned
    Join Date
    Jan 2003
    Posts
    1,708

    question about stacks (and vectors too for that matter)

    How come I can have:
    stack<int> List;
    but when I do the following i get errors:
    stack<stack<int>> List;
    I want to have a stack of stacks of integers. That would be ideal for my program. When I do the same thing with vectors it also doesn't work.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,643
    Try this:
    Code:
    typedef stack<int> intstack;
    ...
    stack<intstack> stack_o_stacks;
    gg

  3. #3
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Code:
    stack<stack<int>>
    Hmm, where have we seen >> operator before? I'm pretty sure that'll confuse the compiler.
    Try: stack<stack<int> >

  4. #4
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    omg that's a load of bull, as if that works
    I can't believe it was that mundane of a problem

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21