c++ - Class data member memory layout shows over-large pointer sizes? -


this class (the data members anyway):

class x{  public:     std::unordered_map<std::string, boost::shared_ptr<y> > a;     std::unordered_map<double, long> b;     std::set<double> c;     std::map<double, long> d;     std::unordered_map<std::string, long> e;     std::string f;     std::mutex g; }; 

and layout generated msvc 2012 compiler:

1>  class x size(264): 1>      +--- 1>   0  |  1>  64  |  b 1>  128 |  c 1>  144 |  d 1>  160 |  e 1>  224 |  f 1>  256 |  g 1>      +--- 

i don't understand why container data members have such large gaps between offsets? addresses in terms of bytes- unordered_map<double, long> data member has 64-byte pointer?!

just thought- there padding, why much!?

the unordered_map class contains several pointers data members implementation , size data members. each of these 8 bytes can 64 bytes in total. same goes set , map.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -