Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8929481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:40:48+00:00 2026-06-15T08:40:48+00:00

Is there any limit on the size of a std::stack ? I am using

  • 0

Is there any limit on the size of a std::stack?

I am using a std::stack<std::pair<int,std::string>> as my stack, and when the number of entries exceeds roughly 1 million, I am getting a runtime error.

Is this due to a restriction on the size of std::stack?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:40:49+00:00Added an answer on June 15, 2026 at 8:40 am

    std::stack is a container adapter. It is merely a front for some other container, that makes it look like a stack. Consider that std::vector can be treated like a stack if you replace the name push with push_back and the name pop with pop_back. Thus, any size limits or similar are going to be the result of the backing container, not std::stack.

    The default backing container for std::stack is std::deque (N3376 23.6.5.2 [stack.defn]). The standard requires that std::deque provide a max_size member function (N3376 23.3.3.1 [deque.overview]/2), which tells you the maximum number of elements that std::deque can hold according to implementation limits. This will typically be something like std::numeric_limits<std::deque<t>::size_type>::max().

    However, it is more likely that you are either running into machine memory limits, or have some bug elsewhere in your application causing the runtime error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to limit a number of characters that are loaded using
Is there any limit on the size of data that we can transfer using
Is there any size limit in arraylist used in where in in java named
Is there any limit on the size of data that can be received by
Are there any implementations of a static size hashtable that limits the entries to
Is there any limit on how much data can be stored using GM_setValue ?
Is there any limit for XML size for which XSLT is applied by XslCompiledTransform
is there any limit when using the file attribute in html to upload file
Is there any limit theoretically on the size of file that can be uploaded
Is there any size limit to the Git commit message? I searched trough the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.