/* Copyright 2018 kevin Lau (http://github.com/stormycatcat)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#ifndef _STDLIB_UTILITY_
#define _STDLIB_UTILITY_

#include <type_traits>

namespace std
{

template<class T>
constexpr typename remove_reference<T>::type&& move(T&& t) noexcept
{
    return static_cast<typename remove_reference<T>::type&&>(t);
}


template<class T>
void swap(T& a,T&b)
{
    T tmp=move(a);
    a=move(b);
    b=move(tmp);
}

template<class T>
typename add_rvalue_reference<T>::type declval()noexcept
{
    using type=typename add_rvalue_reference<T>::type;
    using origin=typename remove_reference<type>::type;
    return static_cast<type>(*static_cast<origin*>(0));
}

}

#endif
