raberu v1.1.0
Fancy Named Parameter Library
 
Loading...
Searching...
No Matches

◆ show()

std::ostream & rbr::as_keyword< typed_keyword< ID, Type > >::show ( std::ostream &  os,
V const &  v 
) const
inlineinherited

Stream insertion function.

Display a textual description of current keyword and bound value over an output stream.

If Keyword defines a display member variable, it will be used to perform this display. Otherwise, its value will be displayed along with either a user-defined identifier or its stringified typename.

Parameters
osOutput stream
vValue bound to current keyword
Returns
The up-to-date output stream

Example:

#include <raberu/raberu.hpp>
// Defines a keyword type that only accept floating point value
struct price_keyword : rbr::as_keyword<price_keyword>
{
using rbr::as_keyword<price_keyword>::operator=;
std::ostream& display(std::ostream& os, auto const& v)
{
return os << "Price: " << v << '$';
}
};
inline constexpr price_keyword price = {};
Base class for keyword definition.
Definition: keywords.hpp:62