How to create a container of noncopyable elements

后端 未结 3 1897
梦谈多话
梦谈多话 2021-01-18 11:44

Is there a way use STL containters with non-copyable elements?

something like this:

class noncopyable
{
    noncopyable(noncopyable&);
    const          


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-18 12:08

    One option is to create a list of pointers to the elements (preferrably a shared_ptr). This is not exactly what you want but it will get the job done.

提交回复
热议问题