From 2ea3240ed66394a4946a22c1532e9aabf2ebe2e4 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Fri, 14 Jul 2017 08:06:24 -0700 Subject: [PATCH] Documentation tidying --- CHANGELOG.md | 4 ++++ include/beast/core/string_param.hpp | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eacb8d3..f65a4738 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +* Documentation tidying + +-------------------------------------------------------------------------------- + Version 81: * Pass string_view by value diff --git a/include/beast/core/string_param.hpp b/include/beast/core/string_param.hpp index 9c90ee64..f3b33e0a 100644 --- a/include/beast/core/string_param.hpp +++ b/include/beast/core/string_param.hpp @@ -24,7 +24,17 @@ namespace beast { passed in contexts where a string is expected. The conversion to string is made using `operator<<` to a non-dynamically allocated static buffer if possible, else to a `std::string` - on overflow. + on overflow. + + To use it, modify your function signature to accept + `string_param` and then extract the string inside the + function: + @code + void print(string_param s) + { + std::cout << s.str(); + } + @endcode */ class string_param { @@ -95,6 +105,13 @@ public: template string_param(Args const&... args); + /// Returns the contained string + string_view + str() const + { + return sv_; + } + /// Implicit conversion to @ref string_view operator string_view const() const {