template<typename T>
struct DGtal::CInteger< T >
Aim: The concept CInteger specifies what are the usual integer numbers, more precisely the ones that are representable on a computer.
Description of concept 'CInteger'
Generally, all the basic computer integer types are models of this concept. More elaborate integer types with variable sizes, for instance the big integers of GMP, are also models of this concept.
Refinement of boost::Assignable<T>,
boost::EqualityComparable<T>, boost::LessThanComparable<T>
Associated types :
Notation
- X : A type that is a model of CInteger
- x, y : object of type X
- i, j : basic integer type.
Definitions
Valid expressions and semantics
<table>
<tr>
<td class=CName> \b Name </td>
<td class=CExpression> \b Expression </td>
<td class=CRequirements> \b Type requirements </td>
<td class=CReturnType> \b Return type </td>
<td class=CPrecondition> \b Precondition </td>
<td class=CSemantics> \b Semantics </td>
<td class=CPostCondition> \b Postcondition </td>
<td class=CComplexity> \b Complexity </td>
</tr>
<tr>
<td class=CName> Construction from basic integer type </td>
<td class=CExpression> X( i ) </td>
<td class=CRequirements> </td>
<td class=CReturnType> </td>
<td class=CPrecondition> </td>
<td class=CSemantics> \t X represents the integer \t i</td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> Addition </td>
<td class=CExpression> \t x + \t y </td>
<td class=CRequirements> </td>
<td class=CReturnType> \t X</td>
<td class=CPrecondition> </td>
<td class=CSemantics> addition of two integers </td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> Subtraction </td>
<td class=CExpression> \t x - \t y </td>
<td class=CRequirements> </td>
<td class=CReturnType> \t X</td>
<td class=CPrecondition> </td>
<td class=CSemantics> subtraction of two integers </td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> Multiplication </td>
<td class=CExpression> \t x * \t y </td>
<td class=CRequirements> </td>
<td class=CReturnType> \t X</td>
<td class=CPrecondition> </td>
<td class=CSemantics> multiplication of two integers </td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> Division </td>
<td class=CExpression> \t x / \t y </td>
<td class=CRequirements> </td>
<td class=CReturnType> \t X</td>
<td class=CPrecondition> </td>
<td class=CSemantics> euclidean division of two integers </td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> Modulo </td>
<td class=CExpression> \t x % \t y </td>
<td class=CRequirements> </td>
<td class=CReturnType> \t X</td>
<td class=CPrecondition> </td>
<td class=CSemantics> modulo of two integers </td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> Pre-increment </td>
<td class=CExpression> ++ \t x </td>
<td class=CRequirements> </td>
<td class=CReturnType> \t X</td>
<td class=CPrecondition> </td>
<td class=CSemantics> \t x is incremented then its value is returned </td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> Pre-decrement </td>
<td class=CExpression> – \t x </td>
<td class=CRequirements> </td>
<td class=CReturnType> \t X</td>
<td class=CPrecondition> </td>
<td class=CSemantics> \t x is decremented then its value is returned </td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> \t X should have constant \t ZERO in \t NumberTraits. </td>
<td class=CExpression> NumberTraits<X>::ZERO </td>
<td class=CRequirements> constant should be defined </td>
<td class=CReturnType> const \t X </td>
<td class=CPrecondition> </td>
<td class=CSemantics> the value 0</td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> \t X should have constant \t ONE in \t NumberTraits. </td>
<td class=CExpression> NumberTraits<X>::ONE </td>
<td class=CRequirements> constant should be defined </td>
<td class=CReturnType> const \t X </td>
<td class=CPrecondition> </td>
<td class=CSemantics> the value 1</td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> \t X should be tagged in \t NumberTraits for \t IsUnsigned. </td>
<td class=CExpression> typename NumberTraits<X>::IsUnsigned </td>
<td class=CRequirements> TagTrue or TagFalse </td>
<td class=CReturnType> </td>
<td class=CPrecondition> </td>
<td class=CSemantics> </td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> \t X should be tagged in \t NumberTraits for \t IsSigned. </td>
<td class=CExpression> typename NumberTraits<X>::IsSigned </td>
<td class=CRequirements> TagTrue or TagFalse </td>
<td class=CReturnType> </td>
<td class=CPrecondition> </td>
<td class=CSemantics> </td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> \t X should be tagged in \t NumberTraits for \t IsBounded. </td>
<td class=CExpression> typename NumberTraits<X>::IsBounded </td>
<td class=CRequirements> TagTrue or TagFalse </td>
<td class=CReturnType> </td>
<td class=CPrecondition> </td>
<td class=CSemantics> </td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> \t X should have type \t SignedVersion in \t NumberTraits. </td>
<td class=CExpression> typename NumberTraits<X>::SignedVersion </td>
<td class=CRequirements> type must be defined </td>
<td class=CReturnType> </td>
<td class=CPrecondition> </td>
<td class=CSemantics> </td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> \t X should have type \t UnsignedVersion in \t NumberTraits. </td>
<td class=CExpression> typename NumberTraits<X>::UnsignedVersion </td>
<td class=CRequirements> type must be defined </td>
<td class=CReturnType> </td>
<td class=CPrecondition> </td>
<td class=CSemantics> </td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
<tr>
<td class=CName> \t X should have type \t ReturnType in \t NumberTraits. </td>
<td class=CExpression> typename NumberTraits<X>::ReturnType </td>
<td class=CRequirements> type must be defined </td>
<td class=CReturnType> </td>
<td class=CPrecondition> </td>
<td class=CSemantics> </td>
<td class=CPostCondition> </td>
<td class=CComplexity> </td>
</tr>
</table>
Invariants
Models
short, int, unsigned int, long long, unsigned long long,
uint16_t, uint32_t, uint64_t, int16_t, int32_t, int64_t,
DGtal::BigInteger
Notes
- Template Parameters:
-
T | the type that should be a model of integer. |
Definition at line 269 of file CInteger.h.