|
Boost Users : |
Subject: [Boost-users] [assign] Nested initialization of std containers
From: Joseph Lisee (jlisee_at_[hidden])
Date: 2009-02-18 11:36:58
I am trying to use list_of and map_list_of to initialize a std::vector
containing std::maps. I am using Boost 1.37 and Mac OS X 10.4 with Apple's G++
4.0.1. Here is a complete example:
#include <vector>
#include <map>
#include <string>
#include <boost/assign/list_of.hpp>
using namespace boost::assign;
typedef std::map<int, std::string> dict;
typedef std::vector<dict> list;
int main()
{
// Works
dict d = map_list_of(1,"B")(2,"A");
list l1 = list_of(d);
// Does not compile
list l2 = list_of(map_list_of(1,"B")(2,"A"));
return 0;
}
Is there some way to get this to work?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net