properly use decltype and throw out the get_return "type trait". It wasn't very useful anyhow.

This commit is contained in:
ThePhD 2015-07-21 19:34:48 -04:00
parent 946d01d228
commit 0460b33d6c
2 changed files with 6 additions and 11 deletions

View File

@ -192,11 +192,6 @@ inline int push_userdata(lua_State* L, Key&& metatablekey, Args&&... args) {
} }
} // detail } // detail
template<typename T>
struct get_return {
typedef decltype(get<T>(nullptr)) type;
};
template <typename T, type expected, typename> template <typename T, type expected, typename>
struct checker { struct checker {
template <typename Handler> template <typename Handler>

View File

@ -42,13 +42,13 @@ class table : public reference {
} }
template<typename Keys, typename... Ret, std::size_t... I> template<typename Keys, typename... Ret, std::size_t... I>
typename return_type<typename stack::get_return<Ret>::type...>::type tuple_get(types<Ret...>, indices<I...>, Keys&& keys) const { auto tuple_get(types<Ret...>, indices<I...>, Keys&& keys) const -> decltype(std::make_tuple(single_get<Ret>(std::get<I>(keys))...)) {
return std::make_tuple(single_get<Ret>(std::get<I>(keys))...); return std::make_tuple(single_get<Ret>(std::get<I>(keys))...);
} }
template<typename Keys, typename Ret> template<typename Keys, std::size_t I, typename Ret>
typename stack::get_return<Ret>::type tuple_get(types<Ret>, indices<0>, Keys&& keys) const { auto tuple_get(types<Ret>, indices<I>, Keys&& keys) const -> decltype(single_get<Ret>(std::get<I>(keys))) {
return single_get<Ret>(std::get<0>(keys)); return single_get<Ret>(std::get<I>(keys));
} }
public: public:
@ -58,9 +58,9 @@ public:
} }
template<typename... Ret, typename... Keys> template<typename... Ret, typename... Keys>
typename return_type<typename stack::get_return<Ret>::type...>::type get(Keys&&... keys) const { auto get(Keys&&... keys) const -> decltype(tuple_get(types<Ret...>(), types<Ret...>(), std::tie(std::forward<Keys>(keys)...))) {
types<Ret...> tr; types<Ret...> tr;
return tuple_get(tr, tr, std::make_tuple(std::forward<Keys>(keys)...)); return tuple_get(tr, tr, std::tie(std::forward<Keys>(keys)...));
} }
template<typename T, typename U> template<typename T, typename U>