Why can't I make a vector of references?

前端 未结 9 585
梦如初夏
梦如初夏 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 04:12

    As other have mentioned, you will probably end up using a vector of pointers instead.

    However, you may want to consider using a ptr_vector instead!

提交回复
热议问题