Skip to content

Commit 4672ae4

Browse files
committed
Add driver functions
1 parent 3e800ce commit 4672ae4

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

include/boost/decimal/string.hpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace decimal {
1616
namespace detail {
1717

1818
template <typename DecimalType>
19-
auto from_string_impl(const std::string& str, std::size_t* idx = nullptr)
19+
auto from_string_impl(const std::string& str, std::size_t* idx)
2020
BOOST_DECIMAL_REQUIRES(detail::is_decimal_floating_point_v, DecimalType)
2121
{
2222
DecimalType val;
@@ -45,6 +45,36 @@ auto from_string_impl(const std::string& str, std::size_t* idx = nullptr)
4545

4646
} // namespace detail
4747

48+
BOOST_DECIMAL_EXPORT inline auto stod32(const std::string& str, std::size_t* idx = nullptr) -> decimal32_t
49+
{
50+
return detail::from_string_impl<decimal32_t>(str, idx);
51+
}
52+
53+
BOOST_DECIMAL_EXPORT inline auto stod32f(const std::string& str, std::size_t* idx = nullptr) -> decimal_fast32_t
54+
{
55+
return detail::from_string_impl<decimal_fast32_t>(str, idx);
56+
}
57+
58+
BOOST_DECIMAL_EXPORT inline auto stod64(const std::string& str, std::size_t* idx = nullptr) -> decimal64_t
59+
{
60+
return detail::from_string_impl<decimal64_t>(str, idx);
61+
}
62+
63+
BOOST_DECIMAL_EXPORT inline auto stod64f(const std::string& str, std::size_t* idx = nullptr) -> decimal_fast64_t
64+
{
65+
return detail::from_string_impl<decimal_fast64_t>(str, idx);
66+
}
67+
68+
BOOST_DECIMAL_EXPORT inline auto stod128(const std::string& str, std::size_t* idx = nullptr) -> decimal128_t
69+
{
70+
return detail::from_string_impl<decimal128_t>(str, idx);
71+
}
72+
73+
BOOST_DECIMAL_EXPORT inline auto stod128f(const std::string& str, std::size_t* idx = nullptr) -> decimal_fast128_t
74+
{
75+
return detail::from_string_impl<decimal_fast128_t>(str, idx);
76+
}
77+
4878
BOOST_DECIMAL_EXPORT template <typename DecimalType>
4979
auto to_string(const DecimalType value)
5080
BOOST_DECIMAL_REQUIRES_RETURN(detail::is_decimal_floating_point_v, DecimalType, std::string)

0 commit comments

Comments
 (0)