You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Workarounds/README.md
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,12 +25,13 @@ You can find these in the `NoModules` directories of this source repository.
25
25
<aname="format"/>
26
26
27
27
## std::format()
28
-
As of today, no compiler [supports](https://en.cppreference.com/w/cpp/compiler_support) the C++20 `<format>` module yet.
28
+
It's not until recently that some major compilers started adding [support](https://en.cppreference.com/w/cpp/compiler_support)for the C++20 `<format>` module.
29
29
This module provides safe, elegant, and efficient text formatting, primeraly in the form of the `std::format()` function,
30
30
and is heavily used throughout the C++20 edition of the book.
31
31
32
-
As a workaround, we recommend the [`{fmt}`](https://fmt.dev/) library,
33
-
a free and open source implementation of a superset of the now standardised `<format>` module.
32
+
If your compiler is too old to [support](https://en.cppreference.com/w/cpp/compiler_support)`<format>` natively,
33
+
we recommend the [`{fmt}`](https://fmt.dev/) library as a workaround.
34
+
It is a free and open source implementation of a superset of the now standardised `<format>` module.
34
35
35
36
Steps:
36
37
1. Download the `fmt` source code
@@ -58,9 +59,10 @@ Steps:
58
59
and all `std::format()` statements will work as expected.
59
60
60
61
Note: this workaround works for `#include <format>` directives (see [Appendix A](../Appendix.pdf));
61
-
but we have not had much luck getting this to work with C++20's `import` declarations.
62
-
Until further notice, we therefore recommend you mostly use the `NoModules` versions of the source code.
63
-
If you do want to experiment with modules, and `std::format()` is getting in the way of that,
62
+
but at the time of writing we weren't having much luck getting this to work with C++20's `import` declarations.
63
+
If you're experiencing similar problems,
64
+
we therefore recommend you mostly use the `NoModules` versions of the source code.
65
+
If you do want to experiment with modules and `std::format()` is getting in the way of that,
64
66
you can, for instance, add the following to your source files
65
67
66
68
namespace std
@@ -98,10 +100,10 @@ you use
98
100
99
101
## Ranges
100
102
101
-
At the time of writing,
102
-
not all Standard Library implementations [support](https://en.cppreference.com/w/cpp/compiler_support) C++20 ranges yet
103
-
(and if they do, not all range algorithms are working as they should).
104
-
As a workaround, you can try the excellent [range-v3](https://github.com/ericniebler/range-v3) library of Eric Niebler.
103
+
Similar to `<format>`,
104
+
it took some time for all Standard Library implementations to add [support](https://en.cppreference.com/w/cpp/compiler_support)for C++20 ranges
105
+
(and if they had support, not all range algorithms were working as they should).
106
+
If you experience issues, you can try the excellent [range-v3](https://github.com/ericniebler/range-v3) library of Eric Niebler instead.
105
107
We added the [header file](ranges) we used for this to this directory.
106
108
The steps you need to get this to work are similar to those we detailed for [`std::format()`](#format),
0 commit comments