diff --git a/include/flatbuffers/flatbuffer_builder.h b/include/flatbuffers/flatbuffer_builder.h index 84bf936d5076..6ee4d8e7b1be 100644 --- a/include/flatbuffers/flatbuffer_builder.h +++ b/include/flatbuffers/flatbuffer_builder.h @@ -589,14 +589,14 @@ template class FlatBufferBuilderImpl { /// @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 - /// 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. template class OffsetT = Offset, // No need to explicitly declare the T type, let the compiler deduce // it. int &...ExplicitArgumentBarrier, typename T> OffsetT CreateString(const T &str) { - return CreateString(str.c_str(), str.length()); + return CreateString(str.data(), str.length()); } /// @brief Store a string in the buffer, which can contain any binary data.