17 lines
415 B
C++
17 lines
415 B
C++
#include <const_fmt/format.h>
|
|
#include <iostream>
|
|
#include <string_view>
|
|
|
|
using namespace const_fmt;
|
|
|
|
int main() {
|
|
constexpr auto s = "This is an integer: {:08}, and this is a float: {:09.4}"_const_fmt(12345, -86.2);
|
|
|
|
// Convert s (with a type of 'std::array<char, N>') into something
|
|
// writable to std::cout
|
|
std::string_view sv{&s[0], s.size()};
|
|
|
|
std::cout << sv << std::endl;
|
|
|
|
return 0;
|
|
} |