2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
2016-02-25 09:48:28 +00:00
|
|
|
Copyright (c) 2011-2016 Bolero MURAKAMI
|
2013-08-08 09:54:33 +00:00
|
|
|
https://github.com/bolero-MURAKAMI/Sprout
|
|
|
|
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
=============================================================================*/
|
2012-04-04 08:48:02 +00:00
|
|
|
#ifndef SPROUT_UTILITY_AS_CONST_HPP
|
|
|
|
#define SPROUT_UTILITY_AS_CONST_HPP
|
|
|
|
|
2012-07-07 05:58:46 +00:00
|
|
|
#include <type_traits>
|
2012-04-04 08:48:02 +00:00
|
|
|
#include <sprout/config.hpp>
|
2012-07-07 05:58:46 +00:00
|
|
|
#include <sprout/utility/forward.hpp>
|
2012-04-04 08:48:02 +00:00
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
//
|
|
|
|
// as_const
|
|
|
|
//
|
|
|
|
template<typename T>
|
2012-07-07 05:58:46 +00:00
|
|
|
inline SPROUT_CONSTEXPR typename std::conditional<
|
|
|
|
std::is_lvalue_reference<T>::value,
|
|
|
|
typename std::remove_reference<T>::type const&,
|
|
|
|
typename std::remove_reference<T>::type const&&
|
|
|
|
>::type
|
|
|
|
as_const(T&& t) {
|
2014-02-22 07:32:51 +00:00
|
|
|
return SPROUT_FORWARD(T, t);
|
2012-04-04 08:48:02 +00:00
|
|
|
}
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_UTILITY_AS_CONST_HPP
|