mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
add type_traits/*
This commit is contained in:
parent
84956034ad
commit
64dd2582a4
13 changed files with 114 additions and 76 deletions
20
sprout/utility/as_lvalue.hpp
Normal file
20
sprout/utility/as_lvalue.hpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef SPROUT_UTILITY_AS_LVALUE_HPP
|
||||
#define SPROUT_UTILITY_AS_LVALUE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// as_lvalue
|
||||
//
|
||||
template<typename T>
|
||||
inline T& as_lvalue(T& t) {
|
||||
return t;
|
||||
}
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR T const& as_lvalue(T const& t) {
|
||||
return t;
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_UTILITY_AS_LVALUE_HPP
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef SPROUT_UTILITY_AS_LVREF_HPP
|
||||
#define SPROUT_UTILITY_AS_LVREF_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// as_lvref
|
||||
//
|
||||
template<typename T>
|
||||
inline T& as_lvref(T& t) {
|
||||
return t;
|
||||
}
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR T const& as_lvref(T const& t) {
|
||||
return t;
|
||||
}
|
||||
|
||||
//
|
||||
// lvref
|
||||
//
|
||||
template<typename T>
|
||||
struct lvref {
|
||||
public:
|
||||
typedef decltype(sprout::as_lvref(std::declval<T&&>())) type;
|
||||
};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_UTILITY_AS_LVREF_HPP
|
|
@ -2,7 +2,7 @@
|
|||
#define SPROUT_UTILITY_OPERATION_EXT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/as_lvref.hpp>
|
||||
#include <sprout/utility/as_lvalue.hpp>
|
||||
#include <sprout/utility/as_const.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_UTILITY_OPERATION_EXT_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue