diff --git a/sol/proxy.hpp b/sol/proxy.hpp index 8dc20d13..b30e558d 100644 --- a/sol/proxy.hpp +++ b/sol/proxy.hpp @@ -57,13 +57,13 @@ public: return *this; } - template - EnableIf>> operator=(U&& other) { + template>> = 0> + void operator=(U&& other) { tbl.set_function(key, std::forward(other)); } - template - DisableIf>> operator=(U&& other) { + template>> = 0> + void operator=(U&& other) { tbl.set(key, std::forward(other)); } @@ -129,6 +129,6 @@ inline bool operator!= (const proxy& right, T&& left) { return right.template get>() != left; } -} // sol - +} // sol + #endif // SOL_PROXY_HPP diff --git a/sol/traits.hpp b/sol/traits.hpp index daddd3f8..f4bbc29a 100644 --- a/sol/traits.hpp +++ b/sol/traits.hpp @@ -32,11 +32,26 @@ struct are_same : std::true_type { }; template struct are_same : std::integral_constant ::value && are_same::value> { }; -template -using EnableIf = typename std::enable_if::type; +template +using Bool = std::integral_constant; -template -using DisableIf = typename std::enable_if::type; +template +using Not = Bool; + +template +using If = typename std::conditional::type; + +template +struct And : Bool {}; + +template +struct And : If, Bool> {}; + +template +using EnableIf = typename std::enable_if::value, int>::type; + +template +using DisableIf = typename std::enable_if>::value, int>::type; template using Unqualified = typename std::remove_cv::type>::type; @@ -70,9 +85,6 @@ struct is_specialization_of : std::false_type { }; template class Templ> struct is_specialization_of, Templ> : std::true_type { }; -template -using Bool = std::integral_constant; - namespace detail { template>::value> struct is_function_impl : std::is_function::type> {};