- 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
futureunwrap.hpp
Go to the documentation of this file.
1 #pragma once
2
7 #ifndef _QI_FUTUREUNWRAP_HPP_
8 #define _QI_FUTUREUNWRAP_HPP_
9
10 #include <type_traits>
11 #include <qi/macro.hpp>
12
13 namespace qi
14 {
15 namespace detail
16 {
17 // Returns a Future<U> if T is a Future<Future<U>>, returns T otherwise.
18 template <typename T>
19 T tryUnwrap(T anything)
20 {
21 return anything;
22 }
23
24 template <typename U>
25 Future<U> tryUnwrap(Future<Future<U>> future)
26 {
27 return future.unwrap();
28 }
29
30 template <typename T>
31 QI_API_DEPRECATED_MSG('last integer argument is deprecated')
32 auto tryUnwrap(T&& anything, int) -> decltype(tryUnwrap(std::forward<T>(anything)))
33 {
34 return tryUnwrap(std::forward<T>(anything));
35 }
36 } // detail
37 } // qi
38
39 #endif // _QI_FUTUREUNWRAP_HPP_
40
qi::Future
Definition: executioncontext.hpp:20
macro.hpp
Various macros for qi. (deprecated, export API, disallow copy, ..) <includename>qi/macro.hpp</includename> .
qi::detail::tryUnwrap
T tryUnwrap(T anything)
Definition: futureunwrap.hpp:19
qi::detail::QI_API_DEPRECATED_MSG
struct QI_API_DEPRECATED_MSG(Use 'QI_TYPE_ENUM'instead) QI_TYPE_ENUM_REGISTER_
Definition: typeinterface.hpp:411