Update README.rst

This commit is contained in:
Victor Zverovich 2018-08-15 06:34:34 -07:00 committed by GitHub
parent 5c0101ab2d
commit 8bbb0b48b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -429,6 +429,29 @@ or the bloat test::
$ make bloat-test
FAQ
---
Q: how can I capture formatting arguments and format them later?
A: use ``std::tuple``:
.. code:: c++
template <typename... Args>
auto capture(const Args&... args) {
return std::make_tuple(args...);
}
auto print_message = [](const auto&... args) {
fmt::print(args...);
};
// Capture and store arguments:
auto args = capture("{} {}", 42, "foo");
// Do formatting:
std::apply(print_message, args);
License
-------