mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Add using statements for basic EnableIf and DisableIf
This commit is contained in:
parent
8ed913e8c1
commit
b80e77b9c2
|
@ -27,6 +27,12 @@
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace sol {
|
namespace sol {
|
||||||
|
template<typename T, typename R = void>
|
||||||
|
using EnableIf = typename std::enable_if<T::value, R>::type;
|
||||||
|
|
||||||
|
template<typename T, typename R = void>
|
||||||
|
using DisableIf = typename std::enable_if<!T::value, R>::type;
|
||||||
|
|
||||||
namespace stack {
|
namespace stack {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -116,7 +122,7 @@ inline T pop(lua_State* L) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline typename std::enable_if<std::is_arithmetic<T>::value>::type push(lua_State* L, T arithmetic) {
|
inline EnableIf<std::is_arithmetic<T>> push(lua_State* L, T arithmetic) {
|
||||||
detail::push_arithmetic(L, arithmetic, std::is_integral<T>{});
|
detail::push_arithmetic(L, arithmetic, std::is_integral<T>{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user