Atomic<T>#Atomic(T): fix C++ compliance

by not calling `std::atomic<T>::atomic(void)`.

After the latter the instance "does not contain a T object, and its only valid uses are destruction and initialization by std::atomic_init" which we don't call. So the only safe option is `std::atomic<T>::atomic(T)`.

https://en.cppreference.com/w/cpp/atomic/atomic/atomic
This commit is contained in:
Alexander Aleksandrovič Klimov 2024-11-05 13:15:22 +01:00 committed by GitHub
parent d894792c36
commit a77259adc1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ public:
*
* @param desired Initial value
*/
inline Atomic(T desired)
inline Atomic(T desired) : std::atomic<T>(desired)
{
this->store(desired);
}
@ -35,7 +35,7 @@ public:
* @param desired Initial value
* @param order Initial store operation's memory order
*/
inline Atomic(T desired, std::memory_order order)
inline Atomic(T desired, std::memory_order order) : std::atomic<T>(desired)
{
this->store(desired, order);
}