String expression that substitutes the values of the passed string expressions into the specified positions in the pattern string, specified at runtime. More...
#include <strexpr.h>
Public Member Functions | |
| constexpr | e_vsubst (str_src< K > pattern, Args &&...args) |
| Creates a string expression that substitutes the values of the passed string expressions into the specified positions in the pattern string, specified at runtime. | |
String expression that substitutes the values of the passed string expressions into the specified positions in the pattern string, specified at runtime.
|
inlineconstexpr |
Creates a string expression that substitutes the values of the passed string expressions into the specified positions in the pattern string, specified at runtime.
| pattern | - the pattern string object into which the values of the passed arguments will be substituted. |
| args... | - the arguments to be substituted into the specified positions in the pattern. As in e_concat, these can be string literals, string expressions, standard strings, and any types that can be converted to string expressions. |
The function creates a string expression that, when materialized, generates text from the pattern, substituting the values of the passed arguments into the substitution positions. The pattern string is specified at runtime by a string object that is parsed at runtime. Insertion points are designated either as {} or {number}. If no number is specified, parameters are substituted in the order passed to the function. If a number is specified, parameters are substituted according to the specified ordinal number. Parameter numbering starts with 1. You cannot mix parameters with and without numbers; only one of the options is used for all substitutions. If numbers are specified, one parameter can participate in multiple substitutions. All passed parameters must participate in substitutions. If a string parsing error occurs, a parse_subst_string_error exception will be thrown. To insert the curly braces themselves, they must be doubled - {{, }}. This function is not a replacement for std::vformat, does not work with the pattern specified at compile-time, and does not support any formatting options for substituted values. All passed arguments must be able to convert themselves to string expressions. (See Converting Types to String Expressions). Example: