2
0
mirror of https://github.com/boostorg/uuid.git synced 2026-01-19 04:42:16 +00:00

Accept Ch[36] in to_chars because these uses did compile

This commit is contained in:
Peter Dimov
2024-05-04 19:38:42 +03:00
parent 4b0620e3b7
commit 436a85cd88
2 changed files with 4 additions and 3 deletions

View File

@@ -179,7 +179,7 @@ to_chars( u, buf );
std::cout << buf << std::endl;
```
NOTE: As a special exception, `N` is allowed to be 36 when `Ch` is `char`.
NOTE: As a special exception, `N` is allowed to be 36.
In this case, the function writes exactly 36 characters into `buffer` and does not write a null terminator.
This use is only supported for backward compatibility and is deprecated.
Use a buffer of 37 characters instead, to allow for the null terminator.

View File

@@ -60,8 +60,9 @@ inline Ch* to_chars( uuid const& u, Ch (&buffer)[ N ] ) noexcept
}
// only provided for compatibility; deprecated
BOOST_DEPRECATED( "Use char[37] instead of char[36] to allow for the null terminator" )
inline char* to_chars( uuid const& u, char (&buffer)[ 36 ] ) noexcept
template<class Ch>
BOOST_DEPRECATED( "Use Ch[37] instead of Ch[36] to allow for the null terminator" )
inline Ch* to_chars( uuid const& u, Ch (&buffer)[ 36 ] ) noexcept
{
detail::to_chars( u, buffer + 0 );
return buffer + 36;