Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <type_traits>
7 :
8 : // note that std::is_convertible is used in the following type aliases as it
9 : // will not match private base classes (unlike std::is_base_of) and some
10 : // analytic data privately inherits from an analytic solution
11 :
12 : /// \ingroup AnalyticSolutionsGroup
13 : /// \brief Empty base class for marking analytic solutions.
14 1 : struct MarkAsAnalyticSolution {};
15 :
16 : /// \ingroup AnalyticSolutionsGroup
17 : /// \brief Check if `T` is an analytic solution
18 : template <typename T>
19 1 : using is_analytic_solution =
20 : typename std::is_convertible<T*, MarkAsAnalyticSolution*>;
21 :
22 : /// \ingroup AnalyticSolutionsGroup
23 : /// \brief `true` if `T` is an analytic solution
24 : template <typename T>
25 1 : constexpr bool is_analytic_solution_v =
26 : std::is_convertible_v<T*, MarkAsAnalyticSolution*>;
|