One¶
-
template<typename TElementType, typename TSfinae = void>
struct One¶ Adapter for the identity element of the given type.
Specialisations of this struct should be stateless trivially default constructible with two call operator of signatures:
TElementType operator()(size_t n) const
(possiblynoexcept
,inline
and/orconstexpr
also) returning a multiplicative identity element for the categoryTElementType
and withDegree<TElementType>()(x)
equal to the parametern
. For example, ifTElementType
is a type of n x n matrices, then this should return the n x n identity matrix.TElementType operator()(T const&) const
(possiblynoexcept
,inline
and/orconstexpr
also). This could be implemented as:TElementType operator()(TElementType const& x) const noexcept { return this->operator()(Degree<TElementType>()(x)); }
- Used by:
- Example
template <typename T> struct One< T, typename std::enable_if<std::is_base_of<PTransf16, T>::value>::type> { T operator()(size_t = 0) const noexcept { return T::one(); } T operator()(T const&) const noexcept { return T::one(); } };
- Template Parameters
TElementType – the type of the elements of a semigroup.
TSfinae – this template parameter can be used for SFINAE.