fw4spl
convert_function_type.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 #ifndef __FWCOM_UTIL_CONVERT_FUNCTION_TYPE_HPP__
7 #define __FWCOM_UTIL_CONVERT_FUNCTION_TYPE_HPP__
8 
9 #include <functional>
10 #include <type_traits>
11 
12 namespace fwCom
13 {
14 
15 namespace util
16 {
17 
18 template <typename F>
20 
22 template <typename R, typename C, typename ... Args >
23 struct convert_function_type< R (C::*)( Args ... ) >
24 {
25  typedef R type ( Args ... );
26 };
27 
29 template <typename R, typename C, typename ... Args >
30 struct convert_function_type< R (C::*)( Args ... ) const >
31 {
32  typedef R type ( Args ... );
33 };
34 
36 template <typename F>
37 struct convert_function_type< std::function< F > >
38 {
39  typedef F type;
40 };
41 
43 template <typename F>
45 {
46  typedef typename std::remove_pointer<F>::type type;
47 };
48 
49 } //namespace util
50 
51 } //namespace fwCom
52 
53 #endif /* __FWCOM_UTIL_CONVERT_FUNCTION_TYPE_HPP__ */
54 
Namespace containing fw4spl communication tools.
Definition: DumpEditor.hpp:30
STL namespace.
Convert function pointer type to function type.