Giter Club home page Giter Club logo

atomic_ref's People

Contributors

avakar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

atomic_ref's Issues

Problems with fetch_add for T*

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.