Dedekind 0.0.0
A structuralist C++23 Module Library
Loading...
Searching...
No Matches
dedekind::algebra::HasSuccessorOperators Concept Referenceexport

Pure syntactic shape: T supports the successor / predecessor operator surface (pre- and post-increment / -decrement, all four). More...

Concept definition

template<typename T>
{ ++a } -> std::same_as<T&>;
{ --a } -> std::same_as<T&>;
{ a++ } -> std::same_as<T>;
{ a-- } -> std::same_as<T>;
}
Pure syntactic shape: T supports the successor / predecessor operator surface (pre- and post-incremen...
Definition group.cppm:144

Detailed Description

Pure syntactic shape: T supports the successor / predecessor operator surface (pre- and post-increment / -decrement, all four).

The Peano-flavoured shape concept naming the C++ operator surface {++a, –a, a++, a–}. The pre-form returns T&; the post-form returns T (by value). Mathematically, this is the successor / predecessor surface — the canonical generator of an IsCyclicGroup or the position-advancement surface of an iterator.

Sibling of HasGroupOperatorsAdd: this concept is the unary in-place arithmetic (translate by 1), where HasGroupOperatorsAdd is the binary out-of-place arithmetic. The semantic claim "this carrier carries a Peano successor structure" lives in morphologies:cyclic (where Modular<N>'s coherence witnesses landed under #391); the shape concept here only checks the operators compile and yield the standard reference / value return types.

Deliberately stricter than std::weakly_incrementable / std::incrementable: the standard concepts loosen postfix ++ to allow any return type (to accommodate iterator categories). The Peano-aligned form requires a++ to return T by value, which is what arithmetic carriers do but iterator categories do not.

Carriers that fire: int, unsigned int, unsigned short, all std::integral types, and also float / double (the shape compiles — ++a and --a are well-formed on floating-point types). The semantic claim "this carrier is a Peano successor structure" lives in IsCyclicGroup and friends; IEEE floating-point fails that semantic claim (rounding makes ++a not coherent with the additive +1) but passes the pure-shape check. Carriers that refuse the shape: bool — pre/post ++ and -- on bool were removed in C++17, so the operators are syntactically ill-formed.

Introduced under #394.