forked from boostorg/static_string
More noexcept, remove dummy parameter from constructor.
This commit is contained in:
@ -380,7 +380,7 @@ template<typename Traits, typename Integer>
|
||||
inline
|
||||
char*
|
||||
integer_to_string(
|
||||
char* str_end, Integer value, std::true_type)
|
||||
char* str_end, Integer value, std::true_type) noexcept
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
@ -404,7 +404,7 @@ template<typename Traits, typename Integer>
|
||||
inline
|
||||
char*
|
||||
integer_to_string(
|
||||
char* str_end, Integer value, std::false_type)
|
||||
char* str_end, Integer value, std::false_type) noexcept
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
@ -420,7 +420,7 @@ template<typename Traits, typename Integer>
|
||||
inline
|
||||
wchar_t*
|
||||
integer_to_wstring(
|
||||
wchar_t* str_end, Integer value, std::true_type)
|
||||
wchar_t* str_end, Integer value, std::true_type) noexcept
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
@ -444,7 +444,7 @@ template<typename Traits, typename Integer>
|
||||
inline
|
||||
wchar_t*
|
||||
integer_to_wstring(
|
||||
wchar_t* str_end, Integer value, std::false_type)
|
||||
wchar_t* str_end, Integer value, std::false_type) noexcept
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
@ -459,7 +459,7 @@ integer_to_wstring(
|
||||
template<std::size_t N, typename Integer>
|
||||
inline
|
||||
static_string<N>
|
||||
to_static_string_int_impl(Integer value)
|
||||
to_static_string_int_impl(Integer value) noexcept
|
||||
{
|
||||
char buffer[N];
|
||||
const auto digits_end = std::end(buffer);
|
||||
@ -471,7 +471,7 @@ to_static_string_int_impl(Integer value)
|
||||
template<std::size_t N, typename Integer>
|
||||
inline
|
||||
static_wstring<N>
|
||||
to_static_wstring_int_impl(Integer value)
|
||||
to_static_wstring_int_impl(Integer value) noexcept
|
||||
{
|
||||
wchar_t buffer[N];
|
||||
const auto digits_end = std::end(buffer);
|
||||
@ -483,20 +483,24 @@ to_static_wstring_int_impl(Integer value)
|
||||
template<std::size_t N, typename Floating>
|
||||
inline
|
||||
static_string<N>
|
||||
to_static_string_float_impl(Floating value)
|
||||
to_static_string_float_impl(Floating value) noexcept
|
||||
{
|
||||
// extra one needed for null terminator
|
||||
char buffer[N + 1];
|
||||
std::sprintf(buffer, "%f", value);
|
||||
// this will not throw
|
||||
return static_string<N>(buffer);
|
||||
}
|
||||
|
||||
template<std::size_t N, typename Floating>
|
||||
inline
|
||||
static_wstring<N>
|
||||
to_static_wstring_float_impl(Floating value)
|
||||
to_static_wstring_float_impl(Floating value) noexcept
|
||||
{
|
||||
// extra one needed for null terminator
|
||||
wchar_t buffer[N + 1];
|
||||
std::swprintf(buffer, N + 1, L"%f", value);
|
||||
// this will not throw
|
||||
return static_wstring<N>(buffer);
|
||||
}
|
||||
|
||||
|
@ -79,20 +79,20 @@ basic_static_string(CharT const* s) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
auto const count = Traits::length(s);
|
||||
BOOST_STATIC_STRING_THROW_IF(count > max_size(),
|
||||
std::length_error{"count > max_size()"});
|
||||
Traits::copy(data(), s, count + 1);
|
||||
this->set_size(count);
|
||||
Traits::copy(data(), s, size() + 1);
|
||||
}
|
||||
|
||||
template<std::size_t N, typename CharT, typename Traits>
|
||||
template<class InputIterator>
|
||||
template<class InputIterator,
|
||||
typename std::enable_if<
|
||||
detail::is_input_iterator<InputIterator>
|
||||
::value>::type*>
|
||||
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||
basic_static_string<N, CharT, Traits>::
|
||||
basic_static_string(
|
||||
InputIterator first,
|
||||
InputIterator last,
|
||||
typename std::enable_if<
|
||||
detail::is_input_iterator<InputIterator>::value,
|
||||
iterator>::type*) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
InputIterator last) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
{
|
||||
assign(first, last);
|
||||
}
|
||||
@ -962,11 +962,11 @@ replace_unchecked(
|
||||
return *this;
|
||||
}
|
||||
|
||||
// string
|
||||
// to_static_string
|
||||
|
||||
static_string<std::numeric_limits<int>::digits10 + 1>
|
||||
inline
|
||||
to_static_string(int value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_string(int value) noexcept
|
||||
{
|
||||
return detail::to_static_string_int_impl<
|
||||
std::numeric_limits<int>::digits10 + 1>(value);
|
||||
@ -974,7 +974,7 @@ to_static_string(int value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_string<std::numeric_limits<long>::digits10 + 1>
|
||||
inline
|
||||
to_static_string(long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_string(long value) noexcept
|
||||
{
|
||||
return detail::to_static_string_int_impl<
|
||||
std::numeric_limits<long>::digits10 + 1>(value);
|
||||
@ -982,7 +982,7 @@ to_static_string(long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_string<std::numeric_limits<long long>::digits10 + 1>
|
||||
inline
|
||||
to_static_string(long long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_string(long long value) noexcept
|
||||
{
|
||||
return detail::to_static_string_int_impl<
|
||||
std::numeric_limits<long long>::digits10 + 1>(value);
|
||||
@ -990,7 +990,7 @@ to_static_string(long long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_string<std::numeric_limits<unsigned int>::digits10 + 1>
|
||||
inline
|
||||
to_static_string(unsigned int value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_string(unsigned int value) noexcept
|
||||
{
|
||||
return detail::to_static_string_int_impl<
|
||||
std::numeric_limits<unsigned int>::digits10 + 1>(value);
|
||||
@ -998,7 +998,7 @@ to_static_string(unsigned int value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_string<std::numeric_limits<unsigned long>::digits10 + 1>
|
||||
inline
|
||||
to_static_string(unsigned long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_string(unsigned long value) noexcept
|
||||
{
|
||||
return detail::to_static_string_int_impl<
|
||||
std::numeric_limits<unsigned long>::digits10 + 1>(value);
|
||||
@ -1006,7 +1006,7 @@ to_static_string(unsigned long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_string<std::numeric_limits<unsigned long long>::digits10 + 1>
|
||||
inline
|
||||
to_static_string(unsigned long long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_string(unsigned long long value) noexcept
|
||||
{
|
||||
return detail::to_static_string_int_impl<
|
||||
std::numeric_limits<unsigned long long>::digits10 + 1>(value);
|
||||
@ -1014,7 +1014,7 @@ to_static_string(unsigned long long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_string<std::numeric_limits<float>::max_digits10 + 1>
|
||||
inline
|
||||
to_static_string(float value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_string(float value) noexcept
|
||||
{
|
||||
return detail::to_static_string_float_impl<
|
||||
std::numeric_limits<float>::max_digits10 + 1>(value);
|
||||
@ -1022,7 +1022,7 @@ to_static_string(float value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_string<std::numeric_limits<double>::max_digits10 + 1>
|
||||
inline
|
||||
to_static_string(double value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_string(double value) noexcept
|
||||
{
|
||||
return detail::to_static_string_float_impl<
|
||||
std::numeric_limits<double>::max_digits10 + 1>(value);
|
||||
@ -1030,17 +1030,16 @@ to_static_string(double value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_string<std::numeric_limits<long double>::max_digits10 + 1>
|
||||
inline
|
||||
to_static_string(long double value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_string(long double value) noexcept
|
||||
{
|
||||
return detail::to_static_string_float_impl<
|
||||
std::numeric_limits<long double>::max_digits10 + 1>(value);
|
||||
}
|
||||
|
||||
// wstring
|
||||
|
||||
// to_static_wstring
|
||||
static_wstring<std::numeric_limits<int>::digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(int value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_wstring(int value) noexcept
|
||||
{
|
||||
return detail::to_static_wstring_int_impl<
|
||||
std::numeric_limits<int>::digits10 + 1>(value);
|
||||
@ -1048,7 +1047,7 @@ to_static_wstring(int value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_wstring<std::numeric_limits<long>::digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_wstring(long value) noexcept
|
||||
{
|
||||
return detail::to_static_wstring_int_impl<
|
||||
std::numeric_limits<long>::digits10 + 1>(value);
|
||||
@ -1056,7 +1055,7 @@ to_static_wstring(long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_wstring<std::numeric_limits<long long>::digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(long long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_wstring(long long value) noexcept
|
||||
{
|
||||
return detail::to_static_wstring_int_impl<
|
||||
std::numeric_limits<long long>::digits10 + 1>(value);
|
||||
@ -1064,7 +1063,7 @@ to_static_wstring(long long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_wstring<std::numeric_limits<unsigned int>::digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(unsigned int value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_wstring(unsigned int value) noexcept
|
||||
{
|
||||
return detail::to_static_wstring_int_impl<
|
||||
std::numeric_limits<unsigned int>::digits10 + 1>(value);
|
||||
@ -1072,7 +1071,7 @@ to_static_wstring(unsigned int value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_wstring<std::numeric_limits<unsigned long>::digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(unsigned long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_wstring(unsigned long value) noexcept
|
||||
{
|
||||
return detail::to_static_wstring_int_impl<
|
||||
std::numeric_limits<unsigned long>::digits10 + 1>(value);
|
||||
@ -1080,7 +1079,7 @@ to_static_wstring(unsigned long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_wstring<std::numeric_limits<unsigned long long>::digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(unsigned long long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_wstring(unsigned long long value) noexcept
|
||||
{
|
||||
return detail::to_static_wstring_int_impl<
|
||||
std::numeric_limits<unsigned long long>::digits10 + 1>(value);
|
||||
@ -1088,7 +1087,7 @@ to_static_wstring(unsigned long long value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_wstring<std::numeric_limits<float>::max_digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(float value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_wstring(float value) noexcept
|
||||
{
|
||||
return detail::to_static_wstring_float_impl<
|
||||
std::numeric_limits<float>::max_digits10 + 1>(value);
|
||||
@ -1096,7 +1095,7 @@ to_static_wstring(float value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_wstring<std::numeric_limits<double>::max_digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(double value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_wstring(double value) noexcept
|
||||
{
|
||||
return detail::to_static_wstring_float_impl<
|
||||
std::numeric_limits<double>::max_digits10 + 1>(value);
|
||||
@ -1104,7 +1103,7 @@ to_static_wstring(double value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
|
||||
static_wstring<std::numeric_limits<long double>::max_digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(long double value) BOOST_STATIC_STRING_COND_NOEXCEPT
|
||||
to_static_wstring(long double value) noexcept
|
||||
{
|
||||
return detail::to_static_wstring_float_impl<
|
||||
std::numeric_limits<long double>::max_digits10 + 1>(value);
|
||||
|
@ -161,17 +161,17 @@ public:
|
||||
|
||||
Construct from a range of characters
|
||||
*/
|
||||
template<class InputIterator>
|
||||
template<class InputIterator
|
||||
#ifndef GENERATING_DOCUMENTATION
|
||||
, typename std::enable_if<
|
||||
detail::is_input_iterator<InputIterator>
|
||||
::value>::type* = nullptr
|
||||
#endif
|
||||
>
|
||||
BOOST_STATIC_STRING_CPP14_CONSTEXPR
|
||||
basic_static_string(
|
||||
InputIterator first,
|
||||
InputIterator last
|
||||
#ifndef GENERATING_DOCUMENTATION
|
||||
, typename std::enable_if<
|
||||
detail::is_input_iterator<InputIterator>::value,
|
||||
iterator>::type* = 0
|
||||
#endif
|
||||
) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
InputIterator last) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
|
||||
/** Construct a `basic_static_string`.
|
||||
|
||||
@ -2898,77 +2898,77 @@ using static_u32string = basic_static_string<N, char32_t>;
|
||||
|
||||
static_string<std::numeric_limits<int>::digits10 + 1>
|
||||
inline
|
||||
to_static_string(int value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_string(int value) noexcept;
|
||||
|
||||
static_string<std::numeric_limits<long>::digits10 + 1>
|
||||
inline
|
||||
to_static_string(long value)BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_string(long value) noexcept;
|
||||
|
||||
static_string<std::numeric_limits<long long>::digits10 + 1>
|
||||
inline
|
||||
to_static_string(long long value)BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_string(long long value) noexcept;
|
||||
|
||||
static_string<std::numeric_limits<unsigned int>::digits10 + 1>
|
||||
inline
|
||||
to_static_string(unsigned int value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_string(unsigned int value) noexcept;
|
||||
|
||||
static_string<std::numeric_limits<unsigned long>::digits10 + 1>
|
||||
inline
|
||||
to_static_string(unsigned long value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_string(unsigned long value) noexcept;
|
||||
|
||||
static_string<std::numeric_limits<unsigned long long>::digits10 + 1>
|
||||
inline
|
||||
to_static_string(unsigned long long value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_string(unsigned long long value) noexcept;
|
||||
|
||||
static_string<std::numeric_limits<float>::max_digits10 + 1>
|
||||
inline
|
||||
to_static_string(float value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_string(float value) noexcept;
|
||||
|
||||
static_string<std::numeric_limits<double>::max_digits10 + 1>
|
||||
inline
|
||||
to_static_string(double value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_string(double value) noexcept;
|
||||
|
||||
static_string<std::numeric_limits<long double>::max_digits10 + 1>
|
||||
inline
|
||||
to_static_string(long double value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_string(long double value) noexcept;
|
||||
|
||||
// wstring
|
||||
|
||||
static_wstring<std::numeric_limits<int>::digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(int value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_wstring(int value) noexcept;
|
||||
|
||||
static_wstring<std::numeric_limits<long>::digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(long value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_wstring(long value) noexcept;
|
||||
|
||||
static_wstring<std::numeric_limits<long long>::digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(long long value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_wstring(long long value) noexcept;
|
||||
|
||||
static_wstring<std::numeric_limits<unsigned int>::digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(unsigned int value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_wstring(unsigned int value) noexcept;
|
||||
|
||||
static_wstring<std::numeric_limits<unsigned long>::digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(unsigned long value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_wstring(unsigned long value) noexcept;
|
||||
|
||||
static_wstring<std::numeric_limits<unsigned long long>::digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(unsigned long long value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_wstring(unsigned long long value) noexcept;
|
||||
|
||||
static_wstring<std::numeric_limits<float>::max_digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(float value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_wstring(float value) noexcept;
|
||||
|
||||
static_wstring<std::numeric_limits<double>::max_digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(double value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_wstring(double value) noexcept;
|
||||
|
||||
static_wstring<std::numeric_limits<long double>::max_digits10 + 1>
|
||||
inline
|
||||
to_static_wstring(long double value) BOOST_STATIC_STRING_COND_NOEXCEPT;
|
||||
to_static_wstring(long double value) noexcept;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
@ -3018,7 +3018,7 @@ namespace std
|
||||
{
|
||||
std::size_t
|
||||
operator()(
|
||||
const boost::static_string::basic_static_string<N, CharT, Traits>& str) const
|
||||
const boost::static_string::basic_static_string<N, CharT, Traits>& str) const noexcept
|
||||
{
|
||||
#ifndef BOOST_STATIC_STRING_STANDALONE
|
||||
return boost::hash_range(str.begin(), str.end());
|
||||
|
Reference in New Issue
Block a user