From 386b6353ed95ad0c415be6e073e5cd48b811e9e4 Mon Sep 17 00:00:00 2001 From: Artem Shilkin <89970996+reshilkin@users.noreply.github.com> Date: Sat, 18 Nov 2023 23:50:51 +0300 Subject: [PATCH] data() instead of c_str() (#8069) --- include/flatbuffers/flatbuffer_builder.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/flatbuffers/flatbuffer_builder.h b/include/flatbuffers/flatbuffer_builder.h index 84bf936d5..6ee4d8e7b 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.