1 2 // Copyright Oliver Kowalke 2014. 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 #ifndef BOOST_CONTEXT_DETAIL_EXCHANGE_H 8 #define BOOST_CONTEXT_DETAIL_EXCHANGE_H 9 10 #include <algorithm> 11 #include <utility> 12 13 #include <boost/config.hpp> 14 15 #ifdef BOOST_HAS_ABI_HEADERS 16 # include BOOST_ABI_PREFIX 17 #endif 18 19 namespace boost { 20 namespace context { 21 namespace detail { 22 23 template< typename T, typename U = T > exchange(T & t,U && nv)24T exchange( T & t, U && nv) { 25 T ov = std::move( t); 26 t = std::forward< U >( nv); 27 return ov; 28 } 29 30 }}} 31 32 #ifdef BOOST_HAS_ABI_HEADERS 33 #include BOOST_ABI_SUFFIX 34 #endif 35 36 #endif // BOOST_CONTEXT_DETAIL_EXCHANGE_H 37