mqtt_cpp
move.hpp
Go to the documentation of this file.
1 // Copyright Takatoshi Kondo 2019
2 //
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 
7 #if !defined(MQTT_MOVE_HPP)
8 #define MQTT_MOVE_HPP
9 
10 #include <utility>
11 #include <type_traits>
12 
13 #include <mqtt/namespace.hpp>
14 
15 namespace MQTT_NS {
16 
17 template <typename T>
18 constexpr
19 typename std::remove_reference_t<T>&&
20 force_move(T&& t) {
21  static_assert(!std::is_const<std::remove_reference_t<T>>::value, "T is const. Fallback to copy.");
22  return std::move(t);
23 }
24 
25 } // namespace MQTT_NS
26 
27 #endif // MQTT_MOVE_HPP
Definition: any.hpp:27
constexpr std::remove_reference_t< T > && force_move(T &&t)
Definition: move.hpp:20