Fix non-variadic function_ref cases to match r221753

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221763 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2014-11-12 03:28:57 +00:00
parent 6cf5613ddb
commit 64f62a02e0

View File

@ -103,7 +103,10 @@ class function_ref<Ret()> {
public: public:
template<typename Callable> template<typename Callable>
function_ref(Callable &&callable) function_ref(Callable &&callable,
typename std::enable_if<
!std::is_same<typename std::remove_reference<Callable>::type,
function_ref>::value>::type * = nullptr)
: callback(callback_fn<typename std::remove_reference<Callable>::type>), : callback(callback_fn<typename std::remove_reference<Callable>::type>),
callable(reinterpret_cast<intptr_t>(&callable)) {} callable(reinterpret_cast<intptr_t>(&callable)) {}
Ret operator()() const { return callback(callable); } Ret operator()() const { return callback(callable); }
@ -122,7 +125,10 @@ class function_ref<Ret(Param1)> {
public: public:
template<typename Callable> template<typename Callable>
function_ref(Callable &&callable) function_ref(Callable &&callable,
typename std::enable_if<
!std::is_same<typename std::remove_reference<Callable>::type,
function_ref>::value>::type * = nullptr)
: callback(callback_fn<typename std::remove_reference<Callable>::type>), : callback(callback_fn<typename std::remove_reference<Callable>::type>),
callable(reinterpret_cast<intptr_t>(&callable)) {} callable(reinterpret_cast<intptr_t>(&callable)) {}
Ret operator()(Param1 param1) { Ret operator()(Param1 param1) {
@ -144,7 +150,10 @@ class function_ref<Ret(Param1, Param2)> {
public: public:
template<typename Callable> template<typename Callable>
function_ref(Callable &&callable) function_ref(Callable &&callable,
typename std::enable_if<
!std::is_same<typename std::remove_reference<Callable>::type,
function_ref>::value>::type * = nullptr)
: callback(callback_fn<typename std::remove_reference<Callable>::type>), : callback(callback_fn<typename std::remove_reference<Callable>::type>),
callable(reinterpret_cast<intptr_t>(&callable)) {} callable(reinterpret_cast<intptr_t>(&callable)) {}
Ret operator()(Param1 param1, Param2 param2) { Ret operator()(Param1 param1, Param2 param2) {
@ -170,7 +179,10 @@ class function_ref<Ret(Param1, Param2, Param3)> {
public: public:
template<typename Callable> template<typename Callable>
function_ref(Callable &&callable) function_ref(Callable &&callable,
typename std::enable_if<
!std::is_same<typename std::remove_reference<Callable>::type,
function_ref>::value>::type * = nullptr)
: callback(callback_fn<typename std::remove_reference<Callable>::type>), : callback(callback_fn<typename std::remove_reference<Callable>::type>),
callable(reinterpret_cast<intptr_t>(&callable)) {} callable(reinterpret_cast<intptr_t>(&callable)) {}
Ret operator()(Param1 param1, Param2 param2, Param3 param3) { Ret operator()(Param1 param1, Param2 param2, Param3 param3) {