Skip to content

Commit 71fe572

Browse files
committed
Add template overload to match from_bid
1 parent 63c121f commit 71fe572

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

include/boost/decimal/bid_conversion.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ constexpr auto to_bid(decimal128_fast val) noexcept -> detail::uint128
135135
return to_bid_d128f(val);
136136
}
137137

138+
template <typename T>
139+
constexpr auto to_bid(T val) noexcept
140+
{
141+
return to_bid(val);
142+
}
143+
138144
template <typename T = decimal32_fast>
139145
constexpr auto from_bid(std::uint32_t bits) noexcept
140146
BOOST_DECIMAL_REQUIRES(detail::is_decimal_floating_point_v, T)

test/test_bid_conversions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void test()
1818
for (std::size_t i {}; i < 1024; ++i)
1919
{
2020
const T val {dist(rng)};
21-
const auto bits {to_bid(val)};
21+
const auto bits {to_bid<T>(val)};
2222
const T return_val {from_bid<T>(bits)};
2323
BOOST_TEST_EQ(val, return_val);
2424
}

0 commit comments

Comments
 (0)