piranha  0.10
Public Types | Public Member Functions | Public Attributes | List of all members
piranha::term< Cf, Key > Class Template Reference

Term class. More...

#include <piranha/term.hpp>

Public Types

using cf_type = Cf
 Alias for the coefficient type.
 
using key_type = Key
 Alias for the key type.
 

Public Member Functions

 term ()
 Default constructor. More...
 
 term (const term &)=default
 Default copy constructor. More...
 
 term (term &&)=default
 Defaulted move constructor.
 
template<typename T , typename U , binary_ctor_enabler< T, U > = 0>
 term (T &&cf, U &&key)
 Constructor from generic coefficient and key. More...
 
 ~term ()
 Destructor.
 
termoperator= (const term &other)=default
 Copy assignment operator. More...
 
termoperator= (term &&other) noexcept
 Move assignment operator. More...
 
bool operator== (const term &other) const
 Equality operator. More...
 
std::size_t hash () const
 Hash value. More...
 
bool is_compatible (const symbol_fset &args) const noexcept
 Compatibility test. More...
 
bool is_zero (const symbol_fset &args) const noexcept
 Zero test. More...
 

Public Attributes

Cf m_cf
 Coefficient member.
 
Key m_key
 Key member.
 

Detailed Description

template<typename Cf, typename Key>
class piranha::term< Cf, Key >

Term class.

This class represents series terms, which are parametrised over a coefficient type Cf and a key type Key. One mutable coefficient instance and one key instance are the only data members and they can be accessed directly.

Type requirements

Exception safety guarantee

Unless otherwise specified, this class provides the strong exception safety guarantee for all operations.

Move semantics

Move semantics is equivalent to the data members' move semantics.

Definition at line 66 of file term.hpp.

Constructor & Destructor Documentation

◆ term() [1/3]

template<typename Cf, typename Key>
piranha::term< Cf, Key >::term ( )
inline

Default constructor.

The default constructor will explicitly call the default constructors of Cf and Key.

Exceptions
unspecifiedany exception thrown by the default constructors of Cf and Key.

Definition at line 86 of file term.hpp.

◆ term() [2/3]

template<typename Cf, typename Key>
piranha::term< Cf, Key >::term ( const term< Cf, Key > &  )
default

Default copy constructor.

Exceptions
unspecifiedany exception thrown by the copy constructors of Cf and Key.

◆ term() [3/3]

template<typename Cf, typename Key>
template<typename T , typename U , binary_ctor_enabler< T, U > = 0>
piranha::term< Cf, Key >::term ( T &&  cf,
U &&  key 
)
inlineexplicit

Constructor from generic coefficient and key.

Note
This constructor is activated only if Cf and Key are constructible from T and U respectively.

This constructor will forward perfectly cf and key to construct coefficient and key.

Parameters
cfargument used for the construction of the coefficient.
keyargument used for the construction of the key.
Exceptions
unspecifiedany exception thrown by the constructors of Cf and Key.

Definition at line 107 of file term.hpp.

Member Function Documentation

◆ hash()

template<typename Cf, typename Key>
std::size_t piranha::term< Cf, Key >::hash ( ) const
inline

Hash value.

The term's hash value is given by its key's hash value.

Returns
hash value of m_key as calculated via a default-constructed instance of std::hash.
Exceptions
unspecifiedany exception thrown by the std::hash specialisation of Key.

Definition at line 160 of file term.hpp.

◆ is_compatible()

template<typename Cf, typename Key>
bool piranha::term< Cf, Key >::is_compatible ( const symbol_fset args) const
inlinenoexcept

Compatibility test.

Parameters
argsreference piranha::symbol_fset.
Returns
the output of the key's is_compatible() method.

Definition at line 170 of file term.hpp.

◆ is_zero()

template<typename Cf, typename Key>
bool piranha::term< Cf, Key >::is_zero ( const symbol_fset args) const
inlinenoexcept

Zero test.

Note that this method is not allowed to throw, so any exception thrown by calling piranha::math::is_zero() on the coefficient will result in the termination of the program.

Parameters
argsreference piranha::symbol_fset.
Returns
true if either the key's is_zero() method or piranha::math::is_zero() on the coefficient return true, false otherwise.

Definition at line 184 of file term.hpp.

◆ operator=() [1/2]

template<typename Cf, typename Key>
term& piranha::term< Cf, Key >::operator= ( const term< Cf, Key > &  other)
default

Copy assignment operator.

The copy assignment operator offers the basic exception safety guarantee.

Parameters
otherassignment argument.
Returns
reference to this.
Exceptions
unspecifiedany exception thrown by the assignment operators of Cf and Key.

◆ operator=() [2/2]

template<typename Cf, typename Key>
term& piranha::term< Cf, Key >::operator= ( term< Cf, Key > &&  other)
inlinenoexcept

Move assignment operator.

Parameters
otherassignment argument.
Returns
reference to this.

Definition at line 132 of file term.hpp.

◆ operator==()

template<typename Cf, typename Key>
bool piranha::term< Cf, Key >::operator== ( const term< Cf, Key > &  other) const
inline

Equality operator.

Equivalence of terms is defined by the equivalence of their keys.

Parameters
othercomparison argument.
Returns
m_key == other.m_key.
Exceptions
unspecifiedany exception thrown by the equality operator of Key.

Definition at line 148 of file term.hpp.


The documentation for this class was generated from the following file: