From eedb2a17964c68a6e575a2d7f1a5b8c54e5a4a85 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 31 May 2014 21:10:42 -0400 Subject: [PATCH] Add key value pair trait --- sol/traits.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sol/traits.hpp b/sol/traits.hpp index 5918d33a..daddd3f8 100644 --- a/sol/traits.hpp +++ b/sol/traits.hpp @@ -170,6 +170,20 @@ struct has_begin_end_impl { template struct has_begin_end : decltype(has_begin_end_impl::test(0)) {}; + +struct has_key_value_pair_impl { + template, + typename V = typename U::value_type, + typename F = decltype(std::declval().first), + typename S = decltype(std::declval().second)> + static std::true_type test(int); + + template + static std::false_type test(...); +}; + +template +struct has_key_value_pair : decltype(has_key_value_pair_impl::test(0)) {}; } // sol #endif // SOL_TRAITS_HPP