I'm working on a project with is written and works with Visual C++ compiler 2010 (and 2008). I'm trying to use new VC++11, but I have a problem with already implemented functions. We already have implemented typdef struct atomic_int and memory_order but they added almost same functions in VC 11 and I get these errors
error C2011: 'std::memory_order' : 'enum' type redefinition
(D:\_work\wp-test\lib\Item.cpp) d:\_work\wp-test\lib\system\Atomic.h
If I catch our implementation into #if statment
#if _MSC_VER >= 1700
#include <atomic>
#else
//out implementation
namspace std{
typedef enum memory_order
{
memory_order_relaxed,
...
} memory_order;
typedef struct atomic_int{
...
}
}
#endif
It seems that works, but one function, that is not implemented in VC 11 is missing and another function cannot convert parameter
error C2039: 'compare_swap' : is not a member of 'std::atomic_int'
D:\_work\wp-test\lib\network\ConnectionSocket.cpp
error C2664: 'std::atomic_int::atomic_int(const std::atomic_int &)' :
cannot convert parameter 1 from 'int' to 'const std::atomic_int &'
(D:\_work\wp-test\lib\Item.cpp) D:\_work\wp-test\lib\system\Cache.h
Please help me find some solution ... how to override whole atomic_int from VC++11, or how to add memeber to ? Thank you
So compare_swap function is old draft name of std::atomic_compare_exchange_weak/strong in . It's allready implemented in C++11, but we used old name.
The another error C2664 also problem of old draft (missing overloaded load method).