2012-10-17 144 views

回答

6

Boost::assign尽可能地接近你。

更具体地说,assign::list_of可能类似于您要查找的行为。

// Examples from the documentation: 
const list<int> primes = list_of(2)(3)(5)(7)(11); 
const stack<string> names = list_of("Mr. Foo")("Mr. Bar")("Mrs. FooBar").to_adapter(); 
map<int,int> next = map_list_of(1,2)(2,3)(3,4)(4,5)(5,6);