having const { on these functions produces an incorrect function resolution of <index_t, false> for store
/Users/smallville7123/Desktop/AAudioTrack/AAudioTrack2/src/main/cpp/ardour/Backends/../AudioEngine/../../smallville7123/plugins/../../ringbuffer/ringbuffer.hpp:62:10: error: no matching member function for call to 'store'
tail.store(head.load(std::memory_order_relaxed), std::memory_order_relaxed);
~~~~~^~~~~
/Users/smallville7123/Desktop/AAudioTrack/AAudioTrack2/src/main/cpp/ardour/Backends/../AudioEngine/../../smallville7123/plugins/../PianoRoll.h:35:24: note: in instantiation of member function 'jnk0le::Ringbuffer<std::__ndk1::pair<unsigned long long, bool>, 1048576, false, 0, unsigned int>::consumerClear' requested here
this->noteData.consumerClear();
^
/Users/smallville7123/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/atomic:1473:10: note: candidate function not viable: no known conversion from 'const std::atomic<unsigned int>' to 'volatile std::__ndk1::__atomic_base<unsigned int, false>' for object argument
void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
^
/Users/smallville7123/Library/Android/sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/atomic:1477:10: note: candidate function not viable: no known conversion from 'const std::atomic<unsigned int>' to 'std::__ndk1::__atomic_base<unsigned int, false>' for object argument
void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
^
1 warning and 1 error generated.
removing const resolves this and allows the store to be resolved correctly
/*!
* \brief Clear buffer from producer side
*/
void producerClear(void) {
//this may fail
head.store(tail.load(std::memory_order_relaxed), std::memory_order_relaxed);
}
/*!
* \brief Clear buffer from consumer side
*/
void consumerClear(void) {
tail.store(head.load(std::memory_order_relaxed), std::memory_order_relaxed);
}
having
const {
on these functions produces an incorrect function resolution of<index_t, false>
forstore
removing
const
resolves this and allows thestore
to be resolved correctly