Using boost::assign::list_of

后端 未结 2 1687
野的像风
野的像风 2020-12-18 23:39

This compiles:

std::vector value = boost::assign::list_of(1)(2);

But not this:

Constructor(std::vector

        
2条回答
  •  孤城傲影
    2020-12-18 23:58

    This is a annoying problem, we also had some time before. We fixed it by using the convert_to_container method:

    Constructor c(boost::assign::list_of(1)(2).convert_to_container >() );
    

    There are more issues with std::list using in constructor too. See Pass std::list to constructor using boost's list_of doesn't compile for the appropriate answer.

提交回复
热议问题