Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well to be honest,

  d = {}
is absolutely not equivalent to a map of int to a vector of ints. Sure in javascript, you can indeed use an object as a map, but you are lacking the type safety that the C++ version provide and all the nice API. Also, in C++11, you can shorten it with auto :

  auto whatever = new std::map<int, std::vector<int>>();
and to be fair with the js, if you want it as short as possible, you could use a using namespace statement for std (although not really recommended) :

  auto whatever = new map<int, vector<int>>();
or maybe not use new :

  map<int, vector<int>> whatever;
I don't think it's that bad. But sure, any dynamic language will be less verbose that a static language because, well, you are removing information...


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: