mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
refs #624 Use ref qualifiers.
This commit is contained in:
@@ -92,10 +92,8 @@ namespace BlackMisc
|
||||
{
|
||||
PointerWrapper(typename std::decay<undecayed_type>::type *obj) : m_obj(std::move(*obj)) {}
|
||||
typename std::decay<undecayed_type>::type const *operator ->() const { return &m_obj; }
|
||||
typename std::decay<undecayed_type>::type operator *() const { return m_obj; }
|
||||
// TODO replace operator* above with the following, when our compilers support C++11 ref-qualifiers
|
||||
//typename std::decay<undecayed_type>::type operator *() const & { return m_obj; }
|
||||
//typename std::decay<undecayed_type>::type operator *() && { return std::move(m_obj); }
|
||||
typename std::decay<undecayed_type>::type operator *() const & { return m_obj; }
|
||||
typename std::decay<undecayed_type>::type operator *() && { return std::move(m_obj); }
|
||||
private:
|
||||
const typename std::decay<undecayed_type>::type m_obj;
|
||||
};
|
||||
|
||||
@@ -19,12 +19,6 @@
|
||||
#include <atomic>
|
||||
#include <utility>
|
||||
|
||||
#if _MSC_VER < 1900
|
||||
#define BLACK_RVALUE_REF_QUALIFIER
|
||||
#else
|
||||
#define BLACK_RVALUE_REF_QUALIFIER &&
|
||||
#endif
|
||||
|
||||
// http://www.drdobbs.com/lock-free-data-structures/184401865
|
||||
// http://en.cppreference.com/w/cpp/memory/shared_ptr/atomic
|
||||
|
||||
@@ -320,7 +314,7 @@ namespace BlackMisc
|
||||
//! \param function The LockFree values from which this LockFreeMulti was constructed will be passed as arguments to this functor.
|
||||
//! \return The value returned by the functor, if any.
|
||||
template <typename F>
|
||||
auto operator ()(F &&function) BLACK_RVALUE_REF_QUALIFIER -> decltype(function(std::declval<Ts>()...))
|
||||
auto operator ()(F &&function) && -> decltype(function(std::declval<Ts>()...))
|
||||
{
|
||||
return call(std::forward<F>(function), Private::make_index_sequence<sizeof...(Ts)>());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user