Constrain to_static_string to integers

This commit is contained in:
Vinnie Falco
2019-03-12 13:40:23 -07:00
parent 30d1972aa2
commit cfbdce3e5c
3 changed files with 9 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ Version 231:
* Doc section names are stable * Doc section names are stable
* Add missing include * Add missing include
* Constrain to_static_string to integers
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@@ -617,7 +617,7 @@ to_static_string(Integer x, std::false_type)
} // detail } // detail
template<class Integer> template<class Integer, class>
static_string<detail::max_digits(sizeof(Integer))> static_string<detail::max_digits(sizeof(Integer))>
to_static_string(Integer x) to_static_string(Integer x)
{ {

View File

@@ -1097,7 +1097,13 @@ operator<<(std::basic_ostream<CharT, Traits>& os,
maximum size large enough to hold the longest possible decimal maximum size large enough to hold the longest possible decimal
representation of any integer of the given type. representation of any integer of the given type.
*/ */
template<class Integer> template<
class Integer
#ifndef BOOST_BEAST_DOXYGEN
,class = typename std::enable_if<
std::is_integral<Integer>::value>::type
#endif
>
static_string<detail::max_digits(sizeof(Integer))> static_string<detail::max_digits(sizeof(Integer))>
to_static_string(Integer x); to_static_string(Integer x);