diff options
Diffstat (limited to 'include/lib/ArduinoJson/Polyfills/utility.hpp')
-rw-r--r-- | include/lib/ArduinoJson/Polyfills/utility.hpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/lib/ArduinoJson/Polyfills/utility.hpp b/include/lib/ArduinoJson/Polyfills/utility.hpp new file mode 100644 index 0000000..c99bc99 --- /dev/null +++ b/include/lib/ArduinoJson/Polyfills/utility.hpp @@ -0,0 +1,28 @@ +// ArduinoJson - https://arduinojson.org +// Copyright Benoit Blanchon 2014-2021 +// MIT License + +#pragma once + +#include "type_traits.hpp" + +namespace ARDUINOJSON_NAMESPACE { +template <typename T> +inline void swap(T& a, T& b) { + T t(a); + a = b; + b = t; +} + +#if ARDUINOJSON_HAS_RVALUE_REFERENCES +template <typename T> +typename remove_reference<T>::type&& move(T&& t) { + return static_cast<typename remove_reference<T>::type&&>(t); +} +#else +template <typename T> +T& move(T& t) { + return t; +} +#endif +} // namespace ARDUINOJSON_NAMESPACE |