From 7c8f28115cea9aa366dba3109adf372570d6c3a0 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Sat, 10 Aug 2013 08:55:00 +0900 Subject: [PATCH] fix string: add explicit for ctor basic_string(T const*) --- sprout/string/string.hpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sprout/string/string.hpp b/sprout/string/string.hpp index aa1815b6..5aa7764d 100644 --- a/sprout/string/string.hpp +++ b/sprout/string/string.hpp @@ -36,14 +36,13 @@ namespace sprout { namespace detail { struct string_raw_construct_t {}; - struct string_from_c_str_construct_t {}; + struct string_checked_construct_t {}; template > class string_construct_access; template class basic_string_impl { - friend class sprout::detail::string_construct_access; public: typedef T value_type; typedef T& reference; @@ -77,7 +76,7 @@ namespace sprout { template SPROUT_CONSTEXPR basic_string_impl( sprout::index_tuple, - sprout::detail::string_from_c_str_construct_t, String const& str, size_type pos, size_type n + sprout::detail::string_checked_construct_t, String const& str, size_type pos, size_type n ) : elems{ (sprout::math::less(Indexes, n) ? str[Indexes + pos] @@ -220,16 +219,16 @@ namespace sprout { arr, 0, NS_SSCRISK_CEL_OR_SPROUT::min(n, sprout::char_traits_helper::traits_type>::length(arr, N2 - 1)) ) {} - SPROUT_CONSTEXPR basic_string(value_type const* s) + explicit SPROUT_CONSTEXPR basic_string(value_type const* s) : impl_type( sprout::make_index_tuple::make(), - sprout::detail::string_from_c_str_construct_t(), s, 0, traits_type::length(s) + sprout::detail::string_checked_construct_t(), s, 0, traits_type::length(s) ) {} SPROUT_CONSTEXPR basic_string(value_type const* s, size_type n) : impl_type( sprout::make_index_tuple::make(), - sprout::detail::string_from_c_str_construct_t(), s, 0, NS_SSCRISK_CEL_OR_SPROUT::min(n, traits_type::length(s)) + sprout::detail::string_checked_construct_t(), s, 0, NS_SSCRISK_CEL_OR_SPROUT::min(n, traits_type::length(s)) ) {} // !!! @@ -239,13 +238,13 @@ namespace sprout { SPROUT_CONSTEXPR basic_string(RandomAccessIterator first, RandomAccessIterator last) : impl_type( sprout::make_index_tuple::make(), - sprout::detail::string_from_c_str_construct_t(), first, 0, sprout::distance(first, last) + sprout::detail::string_checked_construct_t(), first, 0, sprout::distance(first, last) ) {} basic_string(std::initializer_list il) : impl_type( sprout::make_index_tuple::make(), - sprout::detail::string_from_c_str_construct_t(), il.begin(), 0, il.size() + sprout::detail::string_checked_construct_t(), il.begin(), 0, il.size() ) {}