piranha  0.10
polynomial_fwd.hpp
1 /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com)
2 
3 This file is part of the Piranha library.
4 
5 The Piranha library is free software; you can redistribute it and/or modify
6 it under the terms of either:
7 
8  * the GNU Lesser General Public License as published by the Free
9  Software Foundation; either version 3 of the License, or (at your
10  option) any later version.
11 
12 or
13 
14  * the GNU General Public License as published by the Free Software
15  Foundation; either version 3 of the License, or (at your option) any
16  later version.
17 
18 or both in parallel, as here.
19 
20 The Piranha library is distributed in the hope that it will be useful, but
21 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 for more details.
24 
25 You should have received copies of the GNU General Public License and the
26 GNU Lesser General Public License along with the Piranha library. If not,
27 see https://www.gnu.org/licenses/. */
28 
29 #ifndef PIRANHA_POLYNOMIAL_FWD_HPP
30 #define PIRANHA_POLYNOMIAL_FWD_HPP
31 
32 #include <type_traits>
33 
34 #include <piranha/series.hpp>
35 
36 namespace piranha
37 {
38 
39 namespace detail
40 {
41 
42 #if !defined(PIRANHA_DOXYGEN_INVOKED)
43 
44 // Polynomial tag struct to work around is_instace_of bug in GCC.
45 struct polynomial_tag;
46 
47 // Test if a series type has at least one polynomial
48 // in the coefficient hierarchy.
49 template <typename T, typename = void>
50 struct poly_in_cf {
51  static const bool value = false;
52 };
53 
54 template <typename T>
55 struct poly_in_cf<T, typename std::enable_if<(series_recursion_index<T>::value > 0u)
56  && std::is_base_of<polynomial_tag,
57  typename T::term_type::cf_type>::value>::type> {
58  static const bool value = true;
59 };
60 
61 template <typename T>
62 struct poly_in_cf<T, typename std::enable_if<(series_recursion_index<T>::value > 0u)
63  && !std::is_base_of<polynomial_tag,
64  typename T::term_type::cf_type>::value>::type> {
65  static const bool value = poly_in_cf<typename T::term_type::cf_type>::value;
66 };
67 }
68 
69 // Forward declaration of polynomial class.
70 template <typename, typename>
71 class polynomial;
72 
73 #endif
74 }
75 
76 #endif
STL namespace.
Root piranha namespace.
Definition: array_key.hpp:52