FairMQ  1.4.14
C++ Message Queuing Library and Framework
Traits.h
1 /********************************************************************************
2  * Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 
9 #ifndef FAIR_MQ_SDK_TRAITS_H
10 #define FAIR_MQ_SDK_TRAITS_H
11 
12 #include <asio/associated_allocator.hpp>
13 #include <asio/associated_executor.hpp>
14 #include <type_traits>
15 
16 namespace asio {
17 namespace detail {
18 
20 template<typename T, typename Executor>
21 struct associated_executor_impl<T,
22  Executor,
23  std::enable_if_t<is_executor<typename T::ExecutorType>::value>>
24 {
25  using type = typename T::ExecutorType;
26 
27  static auto get(const T& obj, const Executor& /*ex = Executor()*/) noexcept -> type
28  {
29  return obj.GetExecutor();
30  }
31 };
32 
34 template<typename T, typename Allocator>
35 struct associated_allocator_impl<T,
36  Allocator,
37  std::enable_if_t<T::AllocatorType>>
38 {
39  using type = typename T::AllocatorType;
40 
41  static auto get(const T& obj, const Allocator& /*alloc = Allocator()*/) noexcept -> type
42  {
43  return obj.GetAllocator();
44  }
45 };
46 
47 } /* namespace detail */
48 } /* namespace asio */
49 
50 #endif /* FAIR_MQ_SDK_TRAITS_H */
Definition: Error.h:56
Definition: Traits.h:16

privacy