I have this MCVE:
#include <atomic>
#include <map>
#include <string>
struct foo
{
int intValue;
std::atomic_bool bar;
foo( int intValue ) : intValue( intValue ) {};
};
std::map<std::string, foo> myMap;
int main()
{
myMap.emplace( "0", 1234 );
}
It does not compile because std::atomic
is neither copyable nor movable.
My question:
How can I add a class containing a not copyable/moveable object to a std::map
container?