File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -390,6 +390,7 @@ inline size_t PtrByteDiff(const PTR pointer1, const PTR pointer2)
390
390
391
391
// / \brief Pointer to the first element of a string
392
392
// / \param str std::string
393
+ // / \details BytePtr returns NULL pointer for an empty string.
393
394
// / \return Pointer to the first element of a string
394
395
inline byte* BytePtr (std::string& str)
395
396
{
@@ -401,15 +402,14 @@ inline byte* BytePtr(std::string& str)
401
402
return reinterpret_cast <byte*>(&str[0 ]);
402
403
}
403
404
404
- // / \brief Pointer to the first element of a string
405
+ // / \brief Const pointer to the first element of a string
405
406
// / \param str std::string
406
- // / \details Use ConstBytePtr if Microsoft compilers match the wrong function .
407
+ // / \details ConstBytePtr returns non-NULL pointer for an empty string .
407
408
// / \return Pointer to the first element of a string
408
409
inline const byte* ConstBytePtr (const std::string& str)
409
410
{
410
- if (str.empty ())
411
- return NULLPTR;
412
- return reinterpret_cast <const byte*>(&str[0 ]);
411
+ // Use c_str() so a pointer is always available
412
+ return reinterpret_cast <const byte*>(str.c_str ());
413
413
}
414
414
415
415
// / \brief Size of a string
You can’t perform that action at this time.
0 commit comments