Skip to content

Commit

Permalink
Avoid implicit instantiations for the continuous output classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluescarni committed Dec 7, 2023
1 parent 5ca92e7 commit a3916f5
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 13 deletions.
42 changes: 38 additions & 4 deletions include/heyoka/taylor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ template <typename T>
using t_event_batch = detail::t_event_impl<T, true>;

template <typename>
class HEYOKA_DLL_PUBLIC continuous_output;
class HEYOKA_DLL_PUBLIC_INLINE_CLASS continuous_output;

namespace detail
{
Expand All @@ -646,7 +646,7 @@ std::ostream &c_out_stream_impl(std::ostream &, const continuous_output<T> &);
} // namespace detail

template <typename T>
class HEYOKA_DLL_PUBLIC continuous_output
class HEYOKA_DLL_PUBLIC_INLINE_CLASS continuous_output
{
static_assert(detail::is_supported_fp_v<T>, "Unhandled type.");

Expand Down Expand Up @@ -692,6 +692,23 @@ class HEYOKA_DLL_PUBLIC continuous_output
[[nodiscard]] std::size_t get_n_steps() const;
};

// Prevent implicit instantiations.
extern template class continuous_output<float>;
extern template class continuous_output<double>;
extern template class continuous_output<long double>;

#if defined(HEYOKA_HAVE_REAL128)

extern template class continuous_output<mppp::real128>;

#endif

#if defined(HEYOKA_HAVE_REAL)

extern template class continuous_output<mppp::real>;

#endif

template <typename T>
inline std::ostream &operator<<(std::ostream &os, const continuous_output<T> &)
{
Expand Down Expand Up @@ -724,7 +741,7 @@ HEYOKA_DLL_PUBLIC std::ostream &operator<<(std::ostream &, const continuous_outp
#endif

template <typename>
class HEYOKA_DLL_PUBLIC continuous_output_batch;
class HEYOKA_DLL_PUBLIC_INLINE_CLASS continuous_output_batch;

namespace detail
{
Expand All @@ -735,7 +752,7 @@ std::ostream &c_out_batch_stream_impl(std::ostream &, const continuous_output_ba
} // namespace detail

template <typename T>
class HEYOKA_DLL_PUBLIC continuous_output_batch
class HEYOKA_DLL_PUBLIC_INLINE_CLASS continuous_output_batch
{
static_assert(detail::is_supported_fp_v<T>, "Unhandled type.");

Expand Down Expand Up @@ -789,6 +806,23 @@ class HEYOKA_DLL_PUBLIC continuous_output_batch
[[nodiscard]] std::size_t get_n_steps() const;
};

// Prevent implicit instantiations.
extern template class continuous_output_batch<float>;
extern template class continuous_output_batch<double>;
extern template class continuous_output_batch<long double>;

#if defined(HEYOKA_HAVE_REAL128)

extern template class continuous_output_batch<mppp::real128>;

#endif

#if defined(HEYOKA_HAVE_REAL)

extern template class continuous_output_batch<mppp::real>;

#endif

template <typename T>
inline std::ostream &operator<<(std::ostream &os, const continuous_output_batch<T> &)
{
Expand Down
18 changes: 9 additions & 9 deletions src/taylor_01.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2410,19 +2410,19 @@ std::size_t continuous_output<T>::get_n_steps() const
}

// Explicit instantiations.
template class continuous_output<float>;
template class continuous_output<double>;
template class continuous_output<long double>;
template class HEYOKA_DLL_PUBLIC continuous_output<float>;
template class HEYOKA_DLL_PUBLIC continuous_output<double>;
template class HEYOKA_DLL_PUBLIC continuous_output<long double>;

#if defined(HEYOKA_HAVE_REAL128)

template class continuous_output<mppp::real128>;
template class HEYOKA_DLL_PUBLIC continuous_output<mppp::real128>;

#endif

#if defined(HEYOKA_HAVE_REAL)

template class continuous_output<mppp::real>;
template class HEYOKA_DLL_PUBLIC continuous_output<mppp::real>;

#endif

Expand Down Expand Up @@ -3164,13 +3164,13 @@ std::size_t continuous_output_batch<T>::get_n_steps() const
}

// Explicit instantiations.
template class continuous_output_batch<float>;
template class continuous_output_batch<double>;
template class continuous_output_batch<long double>;
template class HEYOKA_DLL_PUBLIC continuous_output_batch<float>;
template class HEYOKA_DLL_PUBLIC continuous_output_batch<double>;
template class HEYOKA_DLL_PUBLIC continuous_output_batch<long double>;

#if defined(HEYOKA_HAVE_REAL128)

template class continuous_output_batch<mppp::real128>;
template class HEYOKA_DLL_PUBLIC continuous_output_batch<mppp::real128>;

#endif

Expand Down

0 comments on commit a3916f5

Please sign in to comment.