|
|
template<bool IS_CONSTEXPR, typename T, typename Ptr = const T*> |
| constexpr auto | fmt::detail::find (Ptr first, Ptr last, T value, Ptr &out) -> bool |
|
template<> |
| auto | fmt::detail::find< false, char > (const char *first, const char *last, char value, const char *&out) -> bool |
|
template<typename T, typename Context, typename Char> |
| auto | fmt::detail::convertArg (BasicFormatArg< Context > &arg, Char type) -> void |
|
template<typename Char> |
| auto | fmt::detail::makeArgFormatter (BasicAppender< Char > iter, FormatSpecs &s) -> ArgFormatter< Char > |
|
template<typename Char> |
| auto | fmt::detail::parseFlags (FormatSpecs &specs, const Char *&it, const Char *end) -> void |
|
template<typename Char, typename GetArg> |
| auto | fmt::detail::parseHeader (const Char *&it, const Char *end, FormatSpecs &specs, GetArg get_arg) -> int |
|
auto | fmt::detail::parsePrintfPresentationType (char c, Type t, bool &upper) -> PresentationType |
|
template<typename Char, typename Context> |
| auto | fmt::detail::vprintf (Buffer< Char > &buf, BasicStringView< Char > format, BasicFormatArgs< Context > args) -> void |
| template<typename Char = char, typename... T> |
| auto | fmt::makePrintfArgs (T &... args) -> decltype(fmt::makeFormatArgs< BasicPrintfContext< Char > >(args...)) |
| template<typename Char> |
| auto | fmt::vsprintf (BasicStringView< Char > fmt, typename VprintfArgs< Char >::type args) -> std::basic_string< Char > |
| template<typename... T> |
| auto | fmt::sprintf (StringView fmt, const T &... args) -> std::string |
| template<typename... T> |
| auto | fmt::sprintf (BasicStringView< wchar_t > fmt, const T &... args) -> std::wstring |
| template<typename Char> |
| auto | fmt::vfprintf (std::FILE *f, BasicStringView< Char > fmt, typename VprintfArgs< Char >::type args) -> int |
| template<typename... T> |
| auto | fmt::fprintf (std::FILE *f, StringView fmt, const T &... args) -> int |
| template<typename... T> |
| auto | fmt::fprintf (std::FILE *f, BasicStringView< wchar_t > fmt, const T &... args) -> int |
| template<typename... T> |
| auto | fmt::printf (StringView fmt, const T &... args) -> int |
printf-style formatting.
Interface partition fmt:printf.
- Copyright
- Copyright (c) 2012 - present, Victor Zverovich and {fmt} contributors. All rights reserved. For the license information refer to format.hpp.
template<typename... T>
| auto fmt::sprintf |
( |
StringView | fmt, |
|
|
const T &... | args ) -> std::string |
|
export |
Formats args according to printf specifications in fmt and returns the result as a string.
Supports the usual printf conversions, with the length modifiers such as ld accepted but ignored: the argument type is taken from the argument itself, so a mismatch cannot occur.
- Parameters
-
| fmt | a printf format string. |
| args | the arguments to format. |
- Returns
- the formatted string.
- Exceptions
-
| fmt::format_error | if the format string is invalid. |
Example:
std::string message = fmt::sprintf("The answer is %d", 42);