Skip to content

Commit

Permalink
fmt::fomatter::format is now cons
Browse files Browse the repository at this point in the history
fmtlib/fmt#3447

Signed-off-by: Emmanuel LE TRONG <[email protected]>
  • Loading branch information
le-migou committed Sep 30, 2024
1 parent 6b3b07b commit 877366b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/calculisto/units/dimension.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <array>
#include "detail/hash_combine.hpp"
using calculisto::hash_combine::hash_combine_range;
#include <algorithm>

namespace
calculisto::units
Expand Down
2 changes: 1 addition & 1 deletion include/calculisto/units/dimension_fmt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fmt::formatter <dimension_t>

template <typename FormatContext>
auto
format (dimension_t const& d, FormatContext& ctx)
format (dimension_t const& d, FormatContext& ctx) const
{
static constexpr auto
dimension_symbol = std::array
Expand Down
4 changes: 2 additions & 2 deletions include/calculisto/units/quantity_fmt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fmt::formatter <any_quantity_t <ValueType>, Char>
format (
any_quantity_t <ValueType> const& quantity
, FormatContext& ctx
){
) const {
for (auto [symbol, unit]: unit::symbols_to_values <ValueType>)
{
if (quantity.dimension / unit.dimension == dimension::none)
Expand Down Expand Up @@ -101,7 +101,7 @@ fmt::formatter <quantity_t <Dimension, ValueType>, Char>
format (
quantity_t <Dimension, ValueType> const& quantity
, FormatContext& ctx
){
) const {
auto const
q = any_quantity_t { quantity.magnitude, Dimension };
return formatter <any_quantity_t <ValueType>>::format (q, ctx);
Expand Down

0 comments on commit 877366b

Please sign in to comment.