On Jun 13, 3:01 am, "Daniel T." <danie...@earthlink.netwrote:
"alien.0...@gmail.com" <alien.0...@gmail.comwrote:
I have written a sample application and adding value to map doesnot
change size
sizeof() returns the *static* size of an object/type, the value is
determined at compile time and never changes.
How can I find how much bytes does the map uses.
You can't do it in any portable way.
You can, sort of. You write a custom allocator which tracks how
much is allocated, and instantiate the map with that.
Whether the information is in anyway useful, of course, is
another issue.
[...]
My main requirement is to store the map as a byte blob in
database and rettrieve back.
That doesn't sound like a very good idea. A map is an
associative array, so is a database table. Why not store the
former as the latter?
For example. More significantly, of course, an std::map is
*not* a byte blob, so it can't be stored directly as such. If
for any reason you need to store it as a byte blob in a
database, you'll first have to marshal it.
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orient�e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S�mard, 78210 St.-Cyr-l'�cole, France, +33 (0)1 30 23 00 34