runnig

STL empty container sizes

Oct 2nd, 2012
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. // Visual Studio 2010 standard library empty container sizes
  2. /*
  3. win32, release
  4. vector size:16
  5. map size:16
  6. string size:28
  7. hashtable size:44
  8. unordered_set size:44
  9. set size:16
  10.  
  11. win32, debug
  12. vector size:20
  13. map size:20
  14. string size:32
  15. hashtable size:56
  16. unordered_set size:56
  17. set size:20
  18.  
  19. */
  20.  
  21. #include "stdafx.h"
  22. #include <vector>
  23. #include <map>
  24. #include <unordered_map>
  25. #include <unordered_set>
  26. #include <set>
  27. #include <iostream>
  28.  
  29.  
  30.  
  31. int _tmain(int argc, _TCHAR* argv[])
  32. {
  33.     std::cout << "vector size:"<<sizeof(std::vector<int>) << std::endl;
  34.     std::cout << "map size:"<<sizeof(std::map<int,int>) << std::endl;
  35.     std::cout << "string size:"<<sizeof(std::string) << std::endl;
  36.     std::cout << "hashtable size:"<<sizeof(std::unordered_map<int,std::string>) << std::endl;
  37.     std::cout << "unordered_set size:"<<sizeof(std::unordered_set<int>) << std::endl;
  38.     std::cout << "set size:"<<sizeof(std::set<int>) << std::endl;
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment