Skip to content

Commit

Permalink
Accept Ch[36] in to_chars because these uses did compile
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed May 4, 2024
1 parent 4b0620e commit 436a85c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/uuid/uuid_io.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions include/boost/uuid/uuid_io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 436a85c

Please sign in to comment.