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;
};