Add using statements for basic EnableIf and DisableIf

This commit is contained in:
Rapptz 2013-11-29 17:57:46 -05:00
parent 8ed913e8c1
commit b80e77b9c2

View File

@ -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>{});
} }