Boost logo

Boost :

From: meadori_at_[hidden]
Date: 2006-06-29 16:44:28


> Quick quesiton would be, is this static or done during runtime?
The creation of the map is all done at compile time. The queries on the map are done at runtime.
So you can have maps like so:
   // namespace scope
   static static_map<const char*, int, 2> map = {
       "Will", 28,
       "Joe", 30
   };

   // class scope
   class foo {
      static static_map<const char*, int, 2> map;
   };
   static_map<const char*, int, 2> foo::map = {
       "Will", 28,
       "Joe", 30
   };

   // function scope
   void bar() {
      static static_map<const char*, int, 2> map = {
         "Will", 28,
         "Joe", 30
       };
   }
all of which are initialized with their key\value pairs at compile time.

--Meador


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk