This struct enables the use of C++20 function std::format
- and with that any adaption of custom types - to be directly appendable to class TAString, without the need of creating an intermediate temporary std::string
.
For that, this struct stores the format string and a tuple of decayed formatting arguments. With a corresponding specialization of struct AppendableTraits, the formatted output is produced using C++20's std::vformat_to
and a std::back_insert_iterator
that appends characters directly to an AString.
char
and wchar_t
. With that, the specializations of AppendableTraits are likewise only defined for these concrete character types. If you compile ALib to switch the default character type, for example, by using compiler symbol ALIB_CHARACTERS_SIZEOF_WCHAR to change the default size (which is defined by the compiler !), then appending this type TStdFormat
might not be available.TChar | The character type of the TAString and the format string. |
TArgs | Variadic template parameters representing the types of the formatting arguments. |
Definition at line 664 of file ALib.Compatibility.StdStrings.H.
#include <ALib.Compatibility.StdStrings.H>
Public Field Index: | |
std::tuple< std::decay_t< TArgs >... > | arguments |
The variadic arguments given construction. Will be passed to std::format . | |
TString< TChar > | format |
The format string given construction. Will be passed to std::format . | |
Public Method Index: | |
TStdFormat (const TString< TChar > &formatString, TArgs &&... args) | |
std::tuple<std::decay_t<TArgs>...> alib::strings::APPENDABLES::TStdFormat< TChar, TArgs >::arguments |
The variadic arguments given construction. Will be passed to std::format
.
Definition at line 669 of file ALib.Compatibility.StdStrings.H.
TString<TChar> alib::strings::APPENDABLES::TStdFormat< TChar, TArgs >::format |
The format string given construction. Will be passed to std::format
.
Definition at line 666 of file ALib.Compatibility.StdStrings.H.
|
inline |
Constructor. Uses perfect forwarding and stores decayed copies of the arguments.
Definition at line 674 of file ALib.Compatibility.StdStrings.H.