Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: getting string format in C++ 20 style? #327

Open
jerabaul29 opened this issue Jan 25, 2021 · 6 comments
Open

Feature request: getting string format in C++ 20 style? #327

jerabaul29 opened this issue Jan 25, 2021 · 6 comments

Comments

@jerabaul29
Copy link
Contributor

C++ 20 received new ways to format strings, in a python-like way (https://en.cppreference.com/w/cpp/utility/format/format), for example:

std::format("{} {}!", "Hello", "world", "something"); // OK, produces "Hello world!"

This looks amazing, as this is both safe, simple to read and write, and starts to be nearly a "de facto standard" across languages (I finally do not need to get confused when switching back and forth between python and c++, hooray!).

I think that the etl provides something quite similar thanks to the to_string API (https://www.etlcpp.com/to_string.html). However, would it be possible to get something that is fully similar / compliant to the C++ 20 std::format? That would make it even easier to use, would reduce brain overhead switching between etl and "standard" C++ 20.

@jwellbelove
Copy link
Contributor

I'll certainly put it on my ToDo list (which is a bit long at the moment!)

@jerabaul29
Copy link
Contributor Author

That sounds amazing :) No worries no hurries, and many thanks :) .

@ValentiWorkLearning
Copy link

It's possible to use fmtlib directly with the specific set of definitions for reducing the binary size of the library.

@evantill
Copy link
Contributor

evantill commented Oct 17, 2022

https://github.com/fmtlib/fmt seems to be great and well tested but use "heavily" the std library.

@jwellbelove
Copy link
Contributor

It may be possible to fork the library and modify it (where possible) to use the ETL, and include it in the ETL.

@jwellbelove
Copy link
Contributor

I looked at the code and the use of the STL is very extensive.
I don't think a modification of the code would be very simple or easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

4 participants