-
Notifications
You must be signed in to change notification settings - Fork 3
C++ dynamic formatting
License
6502/format
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is an attempt to implement a dynamic formatting system for C++. It is different from boost.format approach because it uses named parameters and places formatting options in the format string instead of the calling code. For example the format string "{x:08/2}" formats the field named 'x' using 8 binary digits with leading zeros. There is also support for sequence formatting: std::cout << fmt("[{v:/, :0x{*:02x}}]") % Dict()("v", sequence(v)); given an std::vector containing 1, 2, 3, 4 and 5 will generate as output [0x01, 0x02, 0x03, 0x04, 0x05] This toy project was started as a reply to stackoverflow question http://stackoverflow.com/questions/3692116 I've been always unsatisfied with C++ formatting and I think that C++ streams for formatting are indeed worse than C (moving away from format strings to code). I've had also always a very bad feeling about the C++ approach to formatting options. C++ statically typed output formatting is in my opinion so limiting and annoying that I always use <stdio> if I can and I know I'm not alone. This is just my first attempt at trying to tell something constructive instead of just whining about those problems.
About
C++ dynamic formatting
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published