forked from boostorg/static_string
Guarded static_asserts
This commit is contained in:
@ -126,7 +126,11 @@ CharT*
|
|||||||
raw_to_string(CharT* last, std::size_t size, Integer i)
|
raw_to_string(CharT* last, std::size_t size, Integer i)
|
||||||
{
|
{
|
||||||
boost::ignore_unused(size);
|
boost::ignore_unused(size);
|
||||||
|
#ifdef BOOST_FIXED_STRING_USE_BOOST
|
||||||
BOOST_ASSERT(size >= max_digits(sizeof(Integer)));
|
BOOST_ASSERT(size >= max_digits(sizeof(Integer)));
|
||||||
|
#else
|
||||||
|
assert(size >= max_digits(sizeof(Integer)));
|
||||||
|
#endif
|
||||||
return raw_to_string<CharT, Integer, Traits>(
|
return raw_to_string<CharT, Integer, Traits>(
|
||||||
last, i, std::is_signed<Integer>{});
|
last, i, std::is_signed<Integer>{});
|
||||||
}
|
}
|
||||||
|
@ -916,7 +916,11 @@ public:
|
|||||||
void
|
void
|
||||||
pop_back()
|
pop_back()
|
||||||
{
|
{
|
||||||
|
#ifdef BOOST_FIXED_STRING_USE_BOOST
|
||||||
BOOST_ASSERT(n_ > 0);
|
BOOST_ASSERT(n_ > 0);
|
||||||
|
#else
|
||||||
|
assert(n > 0);
|
||||||
|
#endif
|
||||||
Traits::assign(s_[--n_], 0);
|
Traits::assign(s_[--n_], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -795,7 +795,11 @@ to_fixed_string(Integer x)
|
|||||||
{
|
{
|
||||||
using CharT = char;
|
using CharT = char;
|
||||||
using Traits = std::char_traits<CharT>;
|
using Traits = std::char_traits<CharT>;
|
||||||
|
#ifdef BOOST_FIXED_STRING_USE_BOOST
|
||||||
BOOST_STATIC_ASSERT(std::is_integral<Integer>::value);
|
BOOST_STATIC_ASSERT(std::is_integral<Integer>::value);
|
||||||
|
#else
|
||||||
|
static_assert(std::is_integral<Integer>::value);
|
||||||
|
#endif
|
||||||
char buf[detail::max_digits(sizeof(Integer))];
|
char buf[detail::max_digits(sizeof(Integer))];
|
||||||
auto last = buf + sizeof(buf);
|
auto last = buf + sizeof(buf);
|
||||||
auto it = detail::raw_to_string<
|
auto it = detail::raw_to_string<
|
||||||
|
Reference in New Issue
Block a user