Re: [Boost-users] static maps (was trouble with boost::assign)
On 9/20/05, boost-users-request@lists.boost.org < boost-users-request@lists.boost.org> wrote:
Message: 2 Date: Mon, 19 Sep 2005 12:35:08 -0500 From: "Lee Crabtree" <lcrabtree@goisi.com> Subject: [Boost-users] trouble with boost::assign To: boost-users@lists.boost.org Message-ID: <dgmsos$amg$1@sea.gmane.org>
Hi, I'm trying initialize a static map with map_list_of. Something along the lines of:
map<int,int> blarg = map_list_of(1, 2);
However, when I go to compile, I receive the following error:
... Lee Crabtree
Can't help you with the error, unfortunately, but just wondering - does this map *remain* static after initialization? ie Do you do any inserts or deletes after init? I wrote a static_map<K, T> that is constructed from a static array, which I use for those cases where the map doesn't change, and I was just wondering how useful people thought it might be - ie how often do you have maps that never change after initialization from static data?
I intended for the map to stay completely static, that is, no inserts or deletes were going to be performed. I was going to use it for barcode key/value pairs (as in a 0 in Code 39 has the hex code 0x51DD), since there isn't really an easy way to figure out what goes where. Since I couldn't figure this out, I had to opt for a static array and an enumeration of the names in the proper order. Kind of a crock, but you do what you can, I suppose. Lee -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Gottlob Frege Sent: Tuesday, September 20, 2005 6:42 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] static maps (was trouble with boost::assign) On 9/20/05, boost-users-request@lists.boost.org < boost-users-request@lists.boost.org <mailto:boost-users-request@lists.boost.org> > wrote: Message: 2 Date: Mon, 19 Sep 2005 12:35:08 -0500 From: "Lee Crabtree" <lcrabtree@goisi.com> Subject: [Boost-users] trouble with boost::assign To: boost-users@lists.boost.org Message-ID: <dgmsos$amg$1@sea.gmane.org> Hi, I'm trying initialize a static map with map_list_of. Something along the lines of: map<int,int> blarg = map_list_of(1, 2); However, when I go to compile, I receive the following error: ... Lee Crabtree Can't help you with the error, unfortunately, but just wondering - does this map *remain* static after initialization? ie Do you do any inserts or deletes after init? I wrote a static_map<K, T> that is constructed from a static array, which I use for those cases where the map doesn't change, and I was just wondering how useful people thought it might be - ie how often do you have maps that never change after initialization from static data?
participants (2)
-
Gottlob Frege
-
Lee Crabtree