Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <format>
- #include <fstream>
- #include <iomanip>
- #include <chrono>
- using namespace std;
- double f() { return 123.456; }
- class Cliente {
- private:
- string ragioneSociale = "";
- public:
- Cliente(string rs) { ragioneSociale = rs; }
- string getRagioneSociale() const {return ragioneSociale;}
- };
- template <>
- struct std::formatter<Cliente> : std::formatter<std::string> {
- auto format(Cliente cli, format_context& ctx) {
- return formatter<string>::format(
- std::format("{}", "[[" + cli.getRagioneSociale()+"]]"), ctx);
- }
- };
- int main()
- {
- const string s1 = "primo placeholder";
- const string s2 = "secondo placeholder";
- const string s3 = "primo placeholder";
- const string s5 = "PLACEHOLDER";
- cout << "12345678901234567890\n";
- //for (int i = 1; i < 20; i++)
- //cout << format("{0:10}{1:10} \n", i * i, i * i * i);
- //cout << format("{0:#10x}{1:#10X} \n", i * i, i * i * i);
- //cout << format("{0:#010x}{1:#10X}{2:*<10}\n", i * i, i * i * i, "ciao");
- auto ora = chrono::system_clock::now();
- cout << format("{:%d-%m-%Y %H:%M}\n", ora);
- ofstream file{ "dati.txt" };
- format_to(ostream_iterator<char>(file), "prova, {}!", s3);
- file.close();
- Cliente c1 = Cliente("fcamuso incorporated");
- cout << format("{0:-^30}\n", c1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement