Commit 2cf42c9f authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

Deduction guide for atomic_ref

Summary: [Folly] Deduction guide for `atomic_ref`.

Reviewed By: markisaa

Differential Revision: D21923854

fbshipit-source-id: 8ad10692b95c653fc65302e6ad0118cbd615a62f
parent 2586be5b
...@@ -94,6 +94,13 @@ class atomic_ref : public detail::atomic_ref_select<T> { ...@@ -94,6 +94,13 @@ class atomic_ref : public detail::atomic_ref_select<T> {
using base::base; using base::base;
}; };
#if __cpp_deduction_guides >= 201703
template <typename T>
atomic_ref(T&)->atomic_ref<T>;
#endif
struct make_atomic_ref_t { struct make_atomic_ref_t {
template < template <
typename T, typename T,
...@@ -102,6 +109,9 @@ struct make_atomic_ref_t { ...@@ -102,6 +109,9 @@ struct make_atomic_ref_t {
alignof(T) == alignof(std::atomic<T>), alignof(T) == alignof(std::atomic<T>),
int> = 0> int> = 0>
atomic_ref<T> operator()(T& ref) const { atomic_ref<T> operator()(T& ref) const {
#if __cpp_deduction_guides >= 201703
return atomic_ref{ref};
#endif
return atomic_ref<T>{ref}; return atomic_ref<T>{ref};
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment