/** * @author Edouard DUPIN * @copyright 2011, Edouard DUPIN, all right reserved * @license MPL-2 (see license file) */ #pragma once #include namespace etk { template struct RemoveReference { // remove reference typedef ETK_MOVE_TYPE m_type; }; template struct RemoveReference { // remove reference typedef ETK_MOVE_TYPE m_type; }; template struct RemoveReference { // remove rvalue reference typedef ETK_MOVE_TYPE m_type; }; template inline typename etk::RemoveReference::m_type&& move(ETK_MOVE_TYPE&& _obj) { // forward _Arg as movable return (typename etk::RemoveReference::m_type&&)_obj; } template::value,int>::type = 0> inline void swap(ETK_SWAP_TYPE& _obj1, ETK_SWAP_TYPE& _obj2) { _obj1.swap(_obj2); } template::value,int>::type = 0> inline void swap(ETK_SWAP_TYPE& _obj1, ETK_SWAP_TYPE& _obj2) { ETK_SWAP_TYPE tmp = etk::move(_obj1); _obj1 = etk::move(_obj2); _obj2 = etk::move(tmp); } template inline ETK_FORWARD_TYPE&& forward(typename etk::RemoveReference::m_type& _obj) noexcept { return static_cast(_obj); } template inline ETK_FORWARD_TYPE&& forward(typename etk::RemoveReference::m_type&& _obj) noexcept { static_assert(!etk::IsLeftValueReference::type, "Can not forward a right value as a left value."); return static_cast(_obj); } }