From f5a24893306e6d81df855f23fd07529b462bfb8f Mon Sep 17 00:00:00 2001 From: neargye Date: Thu, 24 Oct 2019 20:36:44 +0500 Subject: [PATCH] update readme --- example/example.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/example/example.cpp b/example/example.cpp index 9729673..c28a6a8 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -102,8 +102,11 @@ int main() { static_assert("structvar"sv == name); name_to_chars(name.c_str()); // 'structvar' - name_to_string(std::string{name}); // 'structvar' + // Note: c_str() return name as null-terminated C string, no memory allocation. + name_to_string(name.to_string()); // 'structvar' + // Note: to_string() occure memory allocation to copy name to std::string. name_to_string_view(name); // 'structvar' + // Note: Implicit cast to std::string_view, no memory allocation. #if defined(NAMEOF_ENUM_SUPPORTED) // Nameof enum variable.