SpECTRE
v2024.09.29
|
Type-erased data for performing math on. More...
#include <MathWrapper.hpp>
Public Types | |
using | value_type = T |
The class's template parameter. | |
using | scalar_type = typename Impl<>::scalar_type |
Scalar type for linear-algebra operations. Either double or std::complex<double>. | |
Public Member Functions | |
T & | operator* () const |
MathWrapper (MathWrapper &&)=default | |
MathWrapper (const MathWrapper &)=delete | |
MathWrapper & | operator= (const MathWrapper &)=delete |
MathWrapper & | operator= (MathWrapper &&)=delete |
operator MathWrapper< const T > () const | |
Convert MathWrapper wrapping a mutable value to one wrapping a const one. More... | |
MathWrapper< const T > | to_const () const |
Convert MathWrapper wrapping a mutable value to one wrapping a const one. More... | |
Friends | |
MathWrapper< T > | make_math_wrapper (tmpl::conditional_t< std::is_const_v< T >, T &, gsl::not_null< T * > >) |
Type-erased data for performing math on.
This class can only be instantiated with possibly const-qualified types from MATH_WRAPPER_TYPES, which can be assumed to support the mathematical operations of a linear-algebra vector. Instances of this class with those template arguments can be created using overloads of make_math_wrapper
(passing a const T&
for const versions and a gsl::not_null<T*>
for mutable versions). Other data structures (such as Variables
) can add additional overloads implemented on top of these basic ones.
MathWrapper< T >::operator MathWrapper< const T > |
Convert MathWrapper wrapping a mutable value to one wrapping a const one.
These methods will fail to compile if called on a MathWrapper wrapping a const value. The to_const
method is useful because C++ fails to resolve the implicit conversion in many cases.
|
inline |
Convert MathWrapper wrapping a mutable value to one wrapping a const one.
These methods will fail to compile if called on a MathWrapper wrapping a const value. The to_const
method is useful because C++ fails to resolve the implicit conversion in many cases.