Thread: question about stacks (and vectors too for that matter)

  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,981
    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