boost::assign::map_list_of and references?

I was trying to initialize a map using map_list_of, and ran into what I consider an undesirable behavior: class stooge { public: stooge(); stooge(const stooge &); stooge &operator =(const stooge &); }; typedef std::map<std::string,const stooge &> MyMap_t; extern const stooge larry,moe,curly; MyMap_t mymap = boost::assign::map_list_of ("larry",larry) ("moe",moe) ("curly",curly); The above leaves mymap full of bogus references - it seems map_list_of is creating temporary copies of the objects, rather than taking their references, and then the map takes references to those temporaries, and blooley! Changing the assignment to: MyMap_t mymap = boost::assign::map_list_of<std::string, const stooge &> doesn't change anything. (and for various reasons, making stooge noncopyable is not an option). This is under gcc 4.5 i686 target. Am I "doing it wrong" or is this an issue with map_list_of?
participants (1)
-
David Hagood