29 #ifndef PIRANHA_TERM_HPP 30 #define PIRANHA_TERM_HPP 34 #include <type_traits> 37 #include <piranha/is_cf.hpp> 38 #include <piranha/is_key.hpp> 39 #include <piranha/math.hpp> 40 #include <piranha/symbol_utils.hpp> 65 template <
typename Cf,
typename Key>
68 PIRANHA_TT_CHECK(
is_cf, Cf);
69 PIRANHA_TT_CHECK(
is_key, Key);
71 template <
typename T,
typename U>
72 using binary_ctor_enabler
73 = enable_if_t<conjunction<std::is_constructible<Cf, T &&>, std::is_constructible<Key, U &&>>::value,
int>;
106 template <
typename T,
typename U, binary_ctor_enabler<T, U> = 0>
134 m_cf = std::move(other.m_cf);
135 m_key = std::move(other.m_key);
162 return std::hash<key_type>{}(
m_key);
172 return m_key.is_compatible(args);
199 template <
typename Cf,
typename Key>
202 static const bool implementation_defined
207 static const bool value = implementation_defined;
210 template <
typename Cf,
typename Key>
218 template <
typename Cf,
typename Key>
size_t result_type
The result type.
Cf m_cf
Coefficient member.
Type trait to detect coefficient types.
std::size_t hash() const
Hash value.
term(T &&cf, U &&key)
Constructor from generic coefficient and key.
term()
Default constructor.
boost::container::flat_set< std::string > symbol_fset
Flat set of symbols.
Key key_type
Alias for the key type.
static const bool value
Default value of the type trait.
bool is_compatible(const symbol_fset &args) const noexcept
Compatibility test.
Cf cf_type
Alias for the coefficient type.
result_type operator()(const argument_type &a) const
Hash operator.
bool is_zero(const T &x)
Zero test.
bool operator==(const term &other) const
Equality operator.
term & operator=(const term &other)=default
Copy assignment operator.
term & operator=(term &&other) noexcept
Move assignment operator.
Type trait for well-behaved container elements.
bool is_zero(const symbol_fset &args) const noexcept
Zero test.