I have a class Cthat does not define operator=. I'm trying to use a vector: std::vector<std::pair<C,D>> vec;. Now, my problem is that I can’t erase a couple after I get this over with. The compiler complains about the lack operator=of C. Can I not have a class vector that does not have this operator? How do I get around this? I can not add an appointment C. This is the error I get:
C
operator=
std::vector<std::pair<C,D>> vec;
error C2582: 'operator =' function is unavailable in 'C' C:\...\include\utility 196 1 my-lib
This is my code:
void Remove(const C& c) { auto i = cs_.begin(); while( i != cs_.end()) { if (i->first == c) { cs_.erase(i); // this is the problem break; } i++; } }
where cs_:
cs_
std::vector<std::pair<C,D>> cs_;
, , , std::vector::end(). .
std::vector::end()
, . , emplace() (pre-++ 11), . , , , , ?
emplace()
( ), std::vector<std::unique_ptr<C>>
std::vector<std::unique_ptr<C>>
. , deque MoveAssignable, erase .
erase
, . , , . (, , MoveAssignable erase), , . , , , .
Source: https://habr.com/ru/post/1523352/More articles:Adding a certificate for the heroku application - sslHaving many methods in one VS controller having multiple controllers - c #Sizes of positive OpenCV samples? - image-processingHow to add image as background for rounded corners in jQuery? - javascriptcreating positive samples for rotated images for cascading learning in OpenCV - opencvNegative sample image sizes for cascading classifier training in OpenCV? - opencvнайти элемент в html и взорвать его для акций - htmlHow to add custom view to ViewPager for walkthrough - androidOpenCV creates samples - invalid background description file - opencvПредотвращение ввода пользователем <или> в поле формы - javascriptAll Articles