From 56fd5773fd2ed117546639d28e65b5770c4f141b Mon Sep 17 00:00:00 2001 From: Baptiste Wicht Date: Wed, 14 Sep 2016 20:41:51 +0200 Subject: [PATCH] Improve std::atomic interface --- tstl/include/atomic.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tstl/include/atomic.hpp b/tstl/include/atomic.hpp index 58112b12..1e7ae16e 100644 --- a/tstl/include/atomic.hpp +++ b/tstl/include/atomic.hpp @@ -24,6 +24,8 @@ struct atomic { atomic(const atomic& rhs) = delete; atomic& operator=(const atomic& rhs) = delete; + explicit atomic(value_type value) : value(value) {} + value_type load() const { return __atomic_load_n(&value, __ATOMIC_CONSUME); } @@ -47,6 +49,8 @@ struct atomic { atomic(const atomic& rhs) = delete; atomic& operator=(const atomic& rhs) = delete; + explicit atomic(value_type value) : value(value) {} + value_type load() const { return __atomic_load_n(&value, __ATOMIC_CONSUME); }