Skip to content

Commit d61d478

Browse files
authored
Merge pull request #908 from cppalliance/fmt_support
2 parents 8e9eccb + a0b7009 commit d61d478

File tree

7 files changed

+730
-3
lines changed

7 files changed

+730
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ jobs:
375375
done
376376
fi
377377
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
378-
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}} locales
378+
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}} locales libfmt-dev
379379
sudo locale-gen de_DE.UTF-8
380380
sudo update-locale
381381
- name: Setup GCC Toolchain

doc/decimal/format.adoc

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ https://www.boost.org/LICENSE_1_0.txt
55
////
66

77
[#format]
8-
= format support
8+
= formating support
99
:idprefix: format_
1010

1111
== <format>
@@ -61,3 +61,26 @@ int main()
6161
return 0;
6262
}
6363
----
64+
65+
== <fmt/format.h>
66+
67+
Support for fmtlib is available as long as `<fmt/format.h>` is present.
68+
All of the above information on modifiers is the same for fmtlib
69+
70+
[source, c++]
71+
----
72+
#include <fmt/format.h>
73+
#include <boost/decimal.hpp>
74+
#include <iostream>
75+
76+
int main()
77+
{
78+
constexpr boost::decimal::decimal64 val1 {314, -2};
79+
constexpr boost::decimal::decimal32 val2 {3141, -3};
80+
81+
std::cout << fmt::format("{:10.3e}", val1) << '\n';
82+
std::cout << fmt::format("{:10.3e}", val2) << std::endl;
83+
84+
return 0;
85+
}
86+
----

include/boost/decimal.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include <boost/decimal/bid_conversion.hpp>
4444
#include <boost/decimal/dpd_conversion.hpp>
4545
#include <boost/decimal/string.hpp>
46+
#include <boost/decimal/fmt_format.hpp>
4647

4748
#if defined(__clang__) && !defined(__GNUC__)
4849
# pragma clang diagnostic pop

0 commit comments

Comments
 (0)