Concept for field types: full algebraic interface.
More...
#include <field_concepts_traits.hpp>
template<typename T>
std::is_base_of_v<details::Base, T> && !std::is_same_v<details::Base, T> && requires(const T& t, T& mutable_t) {
requires std::constructible_from<T>;
requires std::copy_constructible<T>;
requires std::move_constructible<T>;
requires std::constructible_from<T, int>;
{ mutable_t = t } -> std::same_as<T&>;
{ mutable_t = 42 } -> std::same_as<T&>;
{ mutable_t += t } -> std::same_as<T&>;
{ mutable_t -= t } -> std::same_as<T&>;
{ mutable_t *= t } -> std::same_as<T&>;
{ mutable_t /= t } -> std::same_as<T&>;
{ t == t } -> std::same_as<bool>;
{ -t } -> std::same_as<T>;
{ t.is_zero() } -> std::same_as<bool>;
{ t.has_positive_sign() } -> std::same_as<bool>;
{ t.get_characteristic() } -> std::convertible_to<size_t>;
{ t.get_info() } -> std::convertible_to<std::string>;
requires requires { mutable_t.randomize(); };
requires requires { mutable_t.randomize_force_change(); };
}
Concept for field types: full algebraic interface.
Concept for field types: full algebraic interface.
- Template Parameters
-
Requires: compound assignments +=, −=, *=, /=; equality ==; unary −; default, copy, move, and int construction; assignment from T and from int; the property queries is_zero(), has_positive_sign(), get_characteristic(), get_info(); and the randomization methods randomize() / randomize_force_change(). The binary +, −, *, / come for free from the CRTP operators in fields.hpp.
Usage_Example
template <FieldType F>
F discriminant(const F& a, const F& b, const F& c) {
return b * b - F(4) * a * c;
}
- Note
- Satisfied by CECCO::Rationals, CECCO::Fp, CECCO::Ext, and CECCO::Iso.
Definition at line 87 of file field_concepts_traits.hpp.