2012-10-17 145 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);