Boost logo

Boost :

From: Gero Peterhoff (g.peterhoff_at_[hidden])
Date: 2023-04-16 18:52:27


Hello John,
* problem description
The functions of boost::multiprecision are not available in std, e.g.
template <typename type>
Type foo(const Type x) noexcept
{
  return std::sin(x) * 42;
}

using A = double;
A a = foo(A(23)); // ok

using B = boost::multiprecision::cpp_bin_float_oct;
B b = foo(B(23)); // error



As a workaround you currently have to write
template <typename Type>
Type bar(const Type x) noexcept
{
  using ::std::sin;
  using ::boost::multiprecision::sin;
  return sin(x) * 42;
}

using A = double;
A a = bar(A(23)); // ok

using B = boost::multiprecision::cpp_bin_float_oct;
B b = bar(B(23)); // ok


This contradicts the template idea and is time-consuming/error-prone.


thx
Gero




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk