Why can't I make a vector of references?

前端 未结 9 715
梦如初夏
梦如初夏 2020-11-22 03:32

When I do this:

std::vector hello;

Everything works great. However, when I make it a vector of references instead:



        
9条回答
  •  星月不相逢
    2020-11-22 03:57

    boost::ptr_vector will work.

    Edit: was a suggestion to use std::vector< boost::ref >, which will not work because you can't default-construct a boost::ref.

提交回复
热议问题