avakar / atomic_ref Goto Github PK
View Code? Open in Web Editor NEWHeader-only implementation of std::atomic_ref for C++14
License: MIT License
Header-only implementation of std::atomic_ref for C++14
License: MIT License
When I try to compile the tests, I get the following error:
[ 50%] Building CXX object CMakeFiles/avakar_atomic_ref_test.dir/test/test.cpp.o
In file included from .../atomic_ref/test/test.cpp:1:
.../atomic_ref/include/avakar/atomic_ref.h: In instantiation of ‘T* avakar::_atomic_ref<T*>::fetch_add(avakar::_atomic_ref<T*>::difference_type, std::memory_order) const [with T = long unsigned int; avakar::_atomic_ref<T*>::value_type = long unsigned int*; avakar::_atomic_ref<T*>::difference_type = long int; std::memory_order = std::memory_order]’:
.../atomic_ref/test/test.cpp:14:29: required from here
.../atomic_ref/include/avakar/atomic_ref.h:217:40: error: no matching function for call to ‘fetch_add(long unsigned int*&, avakar::_atomic_ref<long unsigned int*, void>::difference_type&, std::memory_order&)’
217 | return _avakar::atomic_ref::fetch_add(_obj, arg, order);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from .../atomic_ref/include/avakar/atomic_ref.h:12,
from .../atomic_ref/test/test.cpp:1:
.../atomic_ref/include/avakar/../../src/atomic_ref.gcc.h:59:3: note: candidate: ‘template<class T> T _avakar::atomic_ref::fetch_add(T&, T, std::memory_order)’
59 | T fetch_add(T & obj, T arg, std::memory_order order) noexcept
| ^~~~~~~~~
.../atomic_ref/include/avakar/../../src/atomic_ref.gcc.h:59:3: note: template argument deduction/substitution failed:
In file included from .../atomic_ref/test/test.cpp:1:
.../atomic_ref/include/avakar/atomic_ref.h:217:40: note: deduced conflicting types for parameter ‘T’ (‘long unsigned int*’ and ‘long int’)
217 | return _avakar::atomic_ref::fetch_add(_obj, arg, order);
As far as I can tell, the complaint is justified. When using atomic_ref<T*>::fetch_add()
, there is no suitable specialization in atomic_ref.gcc.h
: fetch_add
gets T = long unsigend*
, so obj
is long unsigned *&
, which is fine, but the arg with long unsigned*
doesn't make sense, since it's just an integer difference_type
in the caller.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.