Skip to content

Commit

Permalink
data() instead of c_str() (google#8069)
Browse files Browse the repository at this point in the history
  • Loading branch information
reshilkin authored and candysonya committed Jan 8, 2024
1 parent b615d25 commit 4fae09f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/flatbuffers/flatbuffer_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -589,14 +589,14 @@ template<bool Is64Aware = false> 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<template<typename> class OffsetT = Offset,
// No need to explicitly declare the T type, let the compiler deduce
// it.
int &...ExplicitArgumentBarrier, typename T>
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.
Expand Down

0 comments on commit 4fae09f

Please sign in to comment.