From 46c20a843c08174c10807f931ee57d8f22dae5e6 Mon Sep 17 00:00:00 2001 From: Chijun Sima Date: Fri, 24 Aug 2018 15:03:36 +0800 Subject: [PATCH] Use std::size instead of sizeof in string_view example --- CPP17.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CPP17.md b/CPP17.md index 357de77..e22ae62 100644 --- a/CPP17.md +++ b/CPP17.md @@ -287,7 +287,7 @@ std::string_view cppstr{ "foo" }; std::wstring_view wcstr_v{ L"baz" }; // Character arrays. char array[3] = {'b', 'a', 'r'}; -std::string_view array_v(array, sizeof array); +std::string_view array_v(array, std::size(array)); ``` ```c++ std::string str{ " trim me" }; diff --git a/README.md b/README.md index b553f8c..6943aaf 100644 --- a/README.md +++ b/README.md @@ -346,7 +346,7 @@ std::string_view cppstr{ "foo" }; std::wstring_view wcstr_v{ L"baz" }; // Character arrays. char array[3] = {'b', 'a', 'r'}; -std::string_view array_v(array, sizeof array); +std::string_view array_v(array, std::size(array)); ``` ```c++ std::string str{ " trim me" };