mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 09:45:44 +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)) {}
|
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 const *operator ->() const { return &m_obj; }
|
||||||
typename std::decay<undecayed_type>::type 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 *() && { 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:
|
private:
|
||||||
const typename std::decay<undecayed_type>::type m_obj;
|
const typename std::decay<undecayed_type>::type m_obj;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,12 +19,6 @@
|
|||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <utility>
|
#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://www.drdobbs.com/lock-free-data-structures/184401865
|
||||||
// http://en.cppreference.com/w/cpp/memory/shared_ptr/atomic
|
// 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.
|
//! \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.
|
//! \return The value returned by the functor, if any.
|
||||||
template <typename F>
|
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)>());
|
return call(std::forward<F>(function), Private::make_index_sequence<sizeof...(Ts)>());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user