From a506dfd3c13892cc24cc95ec682486ac102f531a Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sat, 6 May 2017 23:40:28 +0900 Subject: [PATCH] add has_resize_method --- toml/traits.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/toml/traits.hpp b/toml/traits.hpp index 88b38c9..935f4e5 100644 --- a/toml/traits.hpp +++ b/toml/traits.hpp @@ -30,6 +30,12 @@ struct has_mapped_type_impl template static std::true_type check(typename T::mapped_type*); template static std::false_type check(...); }; +struct has_resize_method_impl +{ + constexpr static std::size_t dummy=0; + template static std::true_type check(decltype(std::declval().resize(dummy))*); + template static std::false_type check(...); +}; template struct has_iterator : decltype(has_iterator_impl::check(nullptr)){}; @@ -39,6 +45,8 @@ template struct has_key_type : decltype(has_key_type_impl::check(nullptr)){}; template struct has_mapped_type : decltype(has_mapped_type_impl::check(nullptr)){}; +template +struct has_resize_method : decltype(has_resize_method_impl::check(nullptr)){}; template struct is_container : std::integral_constant