async_mqtt 5.0.0
Loading...
Searching...
No Matches
move.hpp
1// Copyright Takatoshi Kondo 2022
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(ASYNC_MQTT_UTIL_MOVE_HPP)
8#define ASYNC_MQTT_UTIL_MOVE_HPP
9
10#include <utility>
11#include <type_traits>
12
13namespace async_mqtt {
14
15template <typename T>
16constexpr
17typename std::remove_reference_t<T>&&
18force_move(T&& t) {
19 static_assert(!std::is_const<std::remove_reference_t<T>>::value, "T is const. Fallback to copy.");
20 return std::move(t);
21}
22
23} // namespace async_mqtt
24
25#endif // ASYNC_MQTT_UTIL_MOVE_HPP