I want to use atomic variable in a map. I am using Visual Studio 2012 (msvc-11) and gcc 4.7. I have defined a type:
typedef std::map<uint64_t, std::atomic<int64_t>> value_map_t;
In msvc-11, lines
value_map_t map;
map[1] = 0;
produce error:
error C2248: 'std::atomic<__int64>::atomic' : cannot access private member declared in class 'std::atomic<__int64>'
Same happens with gcc 4.7 (see here)
error: use of deleted function 'std::atomic::atomic(const std::atomic&)'
However, in Visual Studio 2013 (msvc-12) and beyond, as well as in gcc 4.8 and newer, it works fine.
See for yourself gcc 4.8 and Visual Studio 2013+
What can I do in msvc-11 / gcc 4.7 to make it work ?
Aucun commentaire:
Enregistrer un commentaire