mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-01 02:51:37 +00:00
data() instead of c_str() (#8069)
This commit is contained in:
@@ -589,14 +589,14 @@ template<bool Is64Aware = false> class FlatBufferBuilderImpl {
|
|||||||
|
|
||||||
/// @brief Store a string in the buffer, which can contain any binary data.
|
/// @brief Store a string in the buffer, which can contain any binary data.
|
||||||
/// @param[in] str A const reference to a std::string like type with support
|
/// @param[in] str A const reference to a std::string like type with support
|
||||||
/// of T::c_str() and T::length() to store in the buffer.
|
/// of T::data() and T::length() to store in the buffer.
|
||||||
/// @return Returns the offset in the buffer where the string starts.
|
/// @return Returns the offset in the buffer where the string starts.
|
||||||
template<template<typename> class OffsetT = Offset,
|
template<template<typename> class OffsetT = Offset,
|
||||||
// No need to explicitly declare the T type, let the compiler deduce
|
// No need to explicitly declare the T type, let the compiler deduce
|
||||||
// it.
|
// it.
|
||||||
int &...ExplicitArgumentBarrier, typename T>
|
int &...ExplicitArgumentBarrier, typename T>
|
||||||
OffsetT<String> CreateString(const T &str) {
|
OffsetT<String> CreateString(const T &str) {
|
||||||
return CreateString<OffsetT>(str.c_str(), str.length());
|
return CreateString<OffsetT>(str.data(), str.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Store a string in the buffer, which can contain any binary data.
|
/// @brief Store a string in the buffer, which can contain any binary data.
|
||||||
|
|||||||
Reference in New Issue
Block a user