AP_HAL: functor: use std::remove_reference

This commit is contained in:
Lucas De Marchi 2016-02-16 13:06:35 -02:00
parent 1b55f5f994
commit 10abec277d
1 changed files with 4 additions and 10 deletions

View File

@ -17,8 +17,8 @@
*/ */
#pragma once #pragma once
#ifndef __FUNCTOR_H__
#define __FUNCTOR_H__ #include <type_traits>
#define FUNCTOR_TYPEDEF(name, rettype, ...) \ #define FUNCTOR_TYPEDEF(name, rettype, ...) \
typedef Functor<rettype, ## __VA_ARGS__> name typedef Functor<rettype, ## __VA_ARGS__> name
@ -27,10 +27,10 @@
Functor<rettype, ## __VA_ARGS__> name Functor<rettype, ## __VA_ARGS__> name
#define FUNCTOR_BIND(obj, func, rettype, ...) \ #define FUNCTOR_BIND(obj, func, rettype, ...) \
Functor<rettype, ## __VA_ARGS__>::bind<remove_reference<decltype(*obj)>::type, func>(obj) Functor<rettype, ## __VA_ARGS__>::bind<std::remove_reference<decltype(*obj)>::type, func>(obj)
#define FUNCTOR_BIND_MEMBER(func, rettype, ...) \ #define FUNCTOR_BIND_MEMBER(func, rettype, ...) \
Functor<rettype, ## __VA_ARGS__>::bind<remove_reference<decltype(*this)>::type, func>(this) Functor<rettype, ## __VA_ARGS__>::bind<std::remove_reference<decltype(*this)>::type, func>(this)
template <class RetType, class... Args> template <class RetType, class... Args>
class Functor class Functor
@ -85,9 +85,3 @@ private:
return (t->*method)(args...); return (t->*method)(args...);
} }
}; };
template< class T > struct remove_reference {typedef T type;};
template< class T > struct remove_reference<T&> {typedef T type;};
template< class T > struct remove_reference<T&&> {typedef T type;};
#endif