Below is the fragment of code from the boost library documentation:
#include <boost/assign/list_of.hpp> // for 'list_of()'
#include <boost/assert.hpp>
#include <list>
#include <stack>
#include <string>
using namespace std;
using namespace boost::assign; // bring 'list_of()' into scope
{
const list<int> primes = list_of(2)(3)(5)(7)(11);
BOOST_ASSERT( primes.size() == 5 );
BOOST_ASSERT( primes.back() == 11 );
BOOST_ASSERT( primes.front() == 2 );
const stack<string> names = list_of( "Mr. Foo" )( "Mr. Bar")( "Mrs. FooBar" ).to_adapter();
const stack<string> names2 = (list_of( "Mr. Foo" ), "Mr. Bar", "Mrs. FooBar" ).to_adapter();
BOOST_ASSERT( names.size() == 3 );
BOOST_ASSERT( names.top() == "Mrs. FooBar" );
}
The constructors are called for the objects inside the containers. Are you expecting this behavior?