...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
A function parameter which efficiently converts to string.
Defined in header <boost/beast/core/string_param.hpp>
class string_param
Name |
Description |
---|---|
Implicit conversion to string_view. |
|
Copy assignment (disallowed) |
|
Returns the contained string. |
|
Copy constructor (disallowed) Constructor. |
This is used as a function parameter type to allow callers notational convenience:
objects other than strings may be 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.
To use it, modify your function signature to accept string_param
and then extract the string inside the function:
void print(string_param s) { std::cout << s.str(); }
Convenience header <boost/beast/core.hpp>