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 3216588
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:18:44+00:00 2026-05-17T15:18:44+00:00

A friend sent me this and I really don’t know what it is, inside

  • 0

A friend sent me this and I really don’t know what it is, inside the loop. Whatever it be it calls the std::set constructor half million times…. any help appreciated. I would expect a compiler error, but it actually compiles in g++ 4.4 and 4.5 and the behavior is different to copy construction…

#include <stdio.h>
#include <stdlib.h>
#include <boost/unordered_map.hpp>
#include <set>
#include <string>

typedef boost::unordered_map<int, std::set<int> > mymap;

int main () {
    mymap map;
    for ( int i = 0 ; i < 1000 ; i++ )     
    {
        std::set<int>  map[i] ;
    }
    return 1;
};
  • 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-05-17T15:18:44+00:00Added an answer on May 17, 2026 at 3:18 pm

    You are dealing with a GCC-specific non-standard extension of C++ language. Each iteration defines an array of std::map objects with i elements (and immediately destroys it).

    In standard C++ it is illegal to use a non-constant expression to specify array size, so the code is not legal C++. It compiles, again, only because GCC allows it as an extension.

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

Sidebar

Related Questions

A friend of mine sent me this code snippet to celebrate his new baby
So, my friend sent me a puzzle this morning: Find the number of distinct
My friend sent me a link to this little page which shows a simple
Hello my friend is currently development an application using SOA Architecture, He sent me
A friend sent me his threading class. Now I just want to run a
A friend of mine is learning C++ for the first time, and sent me
I sent a runnable jar to a friend. He double clicks on it and
Well, not my server. My friend found it and sent it to me, trying
My friend sent me one.app and prologs_adhoc.mobileprovision files. I have been trying for hours
This is an error that my friend is getting when testing my app, but

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.