Commit Graph

3510 Commits

Author SHA1 Message Date
Michael Lui
187bd1b8b2 Clarify lifetimes of named_arg parameters (#1051)
* Clarify usage of fmt::arg

Document that fmt::arg takes a non-owning
reference, even if that reference is to
a temporary. As such, users should make sure
the lifetime of the reference lasts as long
as the named argument.

* Clean up language

Remove mentions of `std::reference_wrapper` and rvalues
in favor of more common terminology like dangling references.
2019-02-22 06:37:19 -10:00
Victor Zverovich
4e5694fd05 Update arg signature 2019-02-21 17:38:30 -10:00
Victor Zverovich
82c24edcf6 Workaround a bogus Qt Creator warning 2019-02-19 06:33:55 -10:00
Victor Zverovich
ed138d794a test: assert-test: fix typo in else-branch of EXPECT_DEBUG_DEATH_IF_SUPPORTED
Patch by Ievgen Liubymkin (jackyf).
2019-02-18 14:02:02 -10:00
Victor Zverovich
0476a51cba Add Sublime syntax (#1037) 2019-02-15 15:08:58 -08:00
Victor Zverovich
c5aad69f2a Restore deprecated begin() 2019-02-15 15:00:02 -08:00
Victor Zverovich
5b0006476a Make stopping condition configurable in grisu 2019-02-14 18:25:13 -08:00
Victor Zverovich
a44238f2ef Improve grisu 2019-02-13 20:03:27 -08:00
Victor Zverovich
83808076e3 Minor cleanup 2019-02-13 19:28:02 -08:00
Victor Zverovich
9660ea1bff Simplify format string checks 2019-02-10 18:00:19 -08:00
Park Dong-Ha
4a9d676362 Gradle 4.10 >> Gradle 5.2
TravisCI
- replaced from manual Gradle download to install with 'sdkman'
- changed build name

Gradle
- updated build tool version
2019-02-10 16:15:32 -08:00
Victor Zverovich
f041f128f5 Minor cleanup 2019-02-10 15:20:40 -08:00
Victor Zverovich
e4572e5def Update std implementation 2019-02-10 07:56:33 -08:00
Victor Zverovich
442fa1bd46 Decouple format and parse contexts 2019-02-09 20:39:37 -08:00
Victor Zverovich
744e66bb08 Deprecate format_context::parse_context() 2019-02-09 16:15:20 -08:00
Victor Zverovich
d231d68a8b Fix handling of custom context 2019-02-09 07:36:09 -08:00
Daniela Engert
01f34d0b0b Fix library deprecation warning
Since C++17, using template specialization 'std::allocator<void>' in any shape or form (even just mentioning it) is deprecated! A simple workaround is replacing 'void' by another (preferably empty) type, e.g. 'fmt::monostate'.

Found by Clang 9 in Visual Studio.
2019-02-07 12:20:46 -08:00
morinmorin
9a0a24f90b Test is_streamable with overloaded comma operators 2019-02-06 15:44:59 -08:00
morinmorin
430e6ac9b6 Protect against overloaded comma operators in decltype 2019-02-06 15:44:59 -08:00
Victor Zverovich
467520e7a4 Remove unused macro 2019-02-06 11:34:59 -08:00
Victor Zverovich
5a314a5288 Eliminate extra copy on floating-point formatting 2019-02-06 10:17:50 -08:00
Victor Zverovich
9989e7f4e3
Update benchmark results 2019-02-04 17:56:33 -08:00
Daniela Engert
31510cb437 Fix warnings from Visual Studio
Name hiding.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2019-02-04 11:58:56 -08:00
Daniela Engert
61c9b563c2 Replace 'std::result_of' by 'std::invoke_result' where possible (#1025)
C++17 deprecated 'std::result_of' in favour of 'std::invoke_result' and will ban it outright in C++20. Therefore
- implement 'internal::result_of' in terms of 'std::invoke_result' when compiling C++17 mode.
- implement 'internal::result_of' in terms of 'std::result_of' when compiling in modes C++11 or C++14.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2019-02-04 11:25:22 -08:00
Victor Zverovich
864b9a2202 Correct the comment 2019-02-04 08:29:39 -08:00
Victor Zverovich
1538336836 Remove unnecessary checks 2019-02-04 08:25:41 -08:00
Elias Kosunen
22de5a755f Fix warnings from Travis 2019-02-03 15:25:09 -08:00
Victor Zverovich
355eb6d29a Enable grisu for shortest roundtrip (default) formatting 2019-02-03 10:38:28 -08:00
Victor Zverovich
b8d34e0db3 Fix rounding 2019-02-02 09:19:46 -08:00
Victor Zverovich
e61cac687d Minor grisu improvements 2019-02-02 07:41:52 -08:00
Elias Kosunen
7fbbfed8c6 Fix warnings caused by usage of deprecated functionality 2019-02-02 05:48:39 -08:00
Elias Kosunen
c3268f4e50 Remove use cases of deprecated functionality 2019-02-02 05:48:39 -08:00
Elias Kosunen
34951f1999 Replace comments regarding deprecation with attributes 2019-02-02 05:48:39 -08:00
Victor Zverovich
3f52336e6c Simplify formatter selection 2019-01-30 19:39:42 -08:00
Victor Zverovich
7ca8fc3b17 Fix a bogus warning 2019-01-30 07:06:40 -08:00
Victor Zverovich
5289dd600b Test formatting of special numbers 2019-01-30 06:56:46 -08:00
Victor Zverovich
bf6529f2ce Update docs 2019-01-30 06:07:59 -08:00
Daniela Engert
0700612249 Implement 'chrono' formatting specifiers '%Q' and '%q'
Howard Hinnant's 'date' library recently gained these two new formatting specifiers. This implementation in {fmt} includes support for 'std::chrono::duration' specializations with floating-point representation types and user-definable precision.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2019-01-27 11:10:08 -08:00
Victor Zverovich
06c005b7b0 Clarify that compile-time checks don't support named arguments 2019-01-27 10:10:13 -08:00
Victor Zverovich
4f6fda558c Add a grisu test stub 2019-01-27 10:10:13 -08:00
Daniela Engert
9f70b034e1 Implement precision for floating-point durations.
The formatting syntax follows p1361r0, augmented by a precision field as proposed in #1004.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2019-01-23 07:17:00 -08:00
Victor Zverovich
7cdb1e5e40 Workaround broken is_default_constructible in MSVC 2019-01-21 10:54:49 -08:00
Victor Zverovich
5f1ceebc7f Make formatter<T> override ostream<< for templates (#952) 2019-01-21 09:42:55 -08:00
Victor Zverovich
1b11b000c7 Update readme 2019-01-20 15:33:30 -08:00
Victor Zverovich
83f052930a Add code from p0645 2019-01-20 15:12:01 -08:00
Victor Zverovich
fdd8e333c1 Fix compilation with locales disabled (#1011) 2019-01-19 07:16:05 -08:00
Victor Zverovich
dad1eec842 Workaround unimplemented T... on gcc 4.6.x (#1008) 2019-01-16 11:41:20 -08:00
Daniela Engert
b0cde860ae Implement 'snprintf(OutputIt it, size_t n, const S &format, const Args & ... args)' (#917)
Mostly equivalent to 'sprintf(const S &format, const Args & ... args)' but generates at most 'n' characters through output iterator 'it'. The output type is the same as with 'format_to_n'.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2019-01-13 13:08:01 -05:00
Daniela Engert
e05dfb0887 Fix compile errors due to name-hiding and an unused function argument.
These problems are pointed out by clang-tidy and fail compilation on msvc at /W4 /WX.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2019-01-13 12:18:05 -05:00
Victor Zverovich
dde095fab8 Revert "Reorder defines"
This reverts commit 4a059914a9.
2019-01-13 08:13:38 -08:00