- Aldebaran documentation |
- C++ Libraries |
- index

libqi-api 2.8.7.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mpl.hpp
Go to the documentation of this file.
1 #pragma once
2 /*
3 ** Copyright (C) 2012 Aldebaran Robotics
4 ** See COPYING for the license
5 */
6
7 #ifndef _QI_MPL_HPP_
8 #define _QI_MPL_HPP_
9
10 #include <boost/shared_ptr.hpp>
11 #include <boost/weak_ptr.hpp>
12 #include <type_traits>
13
14 namespace qi
15 {
16 namespace detail
17 {
18
19 template <typename T>
20 struct UnwrapImpl
21 {
22 using type = T;
23 static T* unwrap(T& v)
24 {
25 return &v;
26 }
27 };
28 template <typename T>
29 struct UnwrapImpl<T*>
30 {
31 using type = T;
32 static T* unwrap(T* v)
33 {
34 return v;
35 }
36 };
37 template <typename T>
38 struct UnwrapImpl<boost::shared_ptr<T> >
39 {
40 using type = T;
41 static T* unwrap(boost::shared_ptr<T> v)
42 {
43 return v.get();
44 }
45 };
46 template <typename T>
47 struct UnwrapImpl<boost::weak_ptr<T> >
48 {
49 using type = T;
50 static T* unwrap(boost::weak_ptr<T> v)
51 {
52 return v.lock().get();
53 }
54 };
55
56 template <typename T>
57 struct Unwrap : public UnwrapImpl<typename std::remove_cv<typename std::remove_reference<T>::type>::type>
58 {};
59
60 }
61 }
62
63 #endif
qi::detail::UnwrapImpl< T * >::type
T type
Definition: mpl.hpp:31
qi::detail::UnwrapImpl
Definition: mpl.hpp:20
qi::detail::UnwrapImpl< T * >::unwrap
static T * unwrap(T *v)
Definition: mpl.hpp:32
qi::detail::UnwrapImpl< std::remove_cv< std::remove_reference< T >::type >::type >::type
std::remove_cv< std::remove_reference< T >::type >::type type
Definition: mpl.hpp:22
qi::detail::Unwrap
Definition: mpl.hpp:57
qi::detail::UnwrapImpl::unwrap
static T * unwrap(T &v)
Definition: mpl.hpp:23