summaryrefslogtreecommitdiff
path: root/boost/math/special_functions/log1p.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/math/special_functions/log1p.hpp')
-rw-r--r--boost/math/special_functions/log1p.hpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/boost/math/special_functions/log1p.hpp b/boost/math/special_functions/log1p.hpp
index 9bae7165e4..989bdc21b6 100644
--- a/boost/math/special_functions/log1p.hpp
+++ b/boost/math/special_functions/log1p.hpp
@@ -258,6 +258,34 @@ T log1p_imp(T const& x, const Policy& pol, const mpl::int_<24>&)
return result;
}
+template <class T, class Policy, class tag>
+struct log1p_initializer
+{
+ struct init
+ {
+ init()
+ {
+ do_init(tag());
+ }
+ template <int N>
+ static void do_init(const mpl::int_<N>&){}
+ static void do_init(const mpl::int_<64>&)
+ {
+ boost::math::log1p(static_cast<T>(0.25), Policy());
+ }
+ void force_instantiate()const{}
+ };
+ static const init initializer;
+ static void force_instantiate()
+ {
+ initializer.force_instantiate();
+ }
+};
+
+template <class T, class Policy, class tag>
+const typename log1p_initializer<T, Policy, tag>::init log1p_initializer<T, Policy, tag>::initializer;
+
+
} // namespace detail
template <class T, class Policy>
@@ -286,6 +314,9 @@ inline typename tools::promote_args<T>::type log1p(T x, const Policy&)
>::type
>::type
>::type tag_type;
+
+ detail::log1p_initializer<value_type, forwarding_policy, tag_type>::force_instantiate();
+
return policies::checked_narrowing_cast<result_type, forwarding_policy>(
detail::log1p_imp(static_cast<value_type>(x), forwarding_policy(), tag_type()), "boost::math::log1p<%1%>(%1%)");
}