ゴミ箱
Public Member Functions | List of all members
boost::beast::string_param Class Reference

#include <string_param.hpp>

Public Member Functions

 string_param (string_param const &)=delete
 Copy constructor (disallowed) More...
 
string_paramoperator= (string_param const &)=delete
 Copy assignment (disallowed) More...
 
template<class... Args>
 string_param (Args const &...args)
 
string_view str () const
 Returns the contained string. More...
 
 operator string_view const () const
 Implicit conversion to string_view. More...
 
template<class T0 , class... TN>
void print_n (T0 const &t0, TN const &...tn)
 
template<class T0 , class T1 , class... TN>
void print (T0 const &t0, T1 const &t1, TN const &...tn)
 

Detailed Description

A function parameter which efficiently converts to string.

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();
}

Constructor & Destructor Documentation

boost::beast::string_param::string_param ( string_param const &  )
delete

Copy constructor (disallowed)

template<class... Args>
boost::beast::string_param::string_param ( Args const &...  args)

Constructor

This function constructs a string as if by concatenating the result of streaming each argument in order into an output stream. It is used as a notational convenience at call sites which expect a parameter with the semantics of a string_view.

The implementation uses a small, internal static buffer to avoid memory allocations especially for the case where the list of arguments to be converted consists of a single integral type.

Parameters
argsOne or more arguments to convert

Member Function Documentation

boost::beast::string_param::operator string_view const ( ) const
inline

Implicit conversion to string_view.

string_param& boost::beast::string_param::operator= ( string_param const &  )
delete

Copy assignment (disallowed)

template<class T0 , class T1 , class... TN>
void boost::beast::string_param::print ( T0 const &  t0,
T1 const &  t1,
TN const &...  tn 
)
template<class T0 , class... TN>
void boost::beast::string_param::print_n ( T0 const &  t0,
TN const &...  tn 
)
string_view boost::beast::string_param::str ( ) const
inline

Returns the contained string.


The documentation for this class was generated from the following files: