libqi-api  2.8.7.4
 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>
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 
Various macros for qi. (deprecated, export API, disallow copy, ..) <includename>qi/macro.hpp</includename> .
T tryUnwrap(T anything)
struct QI_API_DEPRECATED_MSG(Use 'QI_TYPE_ENUM'instead) QI_TYPE_ENUM_REGISTER_