Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
gtl::IntType< IntTypeName, _ValueType > Class Template Reference

#include <int_type.h>

Classes

struct  Hasher
 

Public Types

typedef _ValueType ValueType
 
typedef IntType< IntTypeName, ValueTypeThisType
 

Public Member Functions

constexpr IntType ()
 Default c'tor initializing value_ to 0.
 
constexpr IntType (ValueType value)
 C'tor explicitly initializing from a ValueType.
 
constexpr ValueType value () const
 
template<typename ValType >
constexpr ValType value () const
 
ThisTypeoperator++ ()
 – UNARY OPERATORS -----------------------------------------------------—
 
const ThisType operator++ (int v)
 
ThisTypeoperator-- ()
 
const ThisType operator-- (int v)
 
constexpr bool operator! () const
 
constexpr const ThisType operator+ () const
 
constexpr const ThisType operator- () const
 
constexpr const ThisType operator~ () const
 
 INT_TYPE_ASSIGNMENT_OP (+=)
 
 INT_TYPE_ASSIGNMENT_OP (-=)
 
INT_TYPE_ASSIGNMENT_OP * INT_TYPE_ASSIGNMENT_OP (/=);INT_TYPE_ASSIGNMENT_OP(<<=
 
 INT_TYPE_ASSIGNMENT_OP (> >=)
 
 INT_TYPE_ASSIGNMENT_OP (%=)
 
ThisTypeoperator= (ValueType arg_value)
 

Static Public Member Functions

static constexpr absl::string_view TypeName ()
 

Detailed Description

template<typename IntTypeName, typename _ValueType>
class gtl::IntType< IntTypeName, _ValueType >

Holds a integral value (of type ValueType) and behaves as a ValueType by exposing assignment, unary, comparison, and arithmetic operators.

The template parameter IntTypeName defines the name for the int type and must be unique within a binary (the convenient DEFINE_INT_TYPE macro at the end of the file generates a unique IntTypeName). The parameter ValueType defines the integer type value (see supported list above).

This class is NOT thread-safe.

Definition at line 184 of file int_type.h.

Member Typedef Documentation

◆ ThisType

template<typename IntTypeName , typename _ValueType >
IntType<IntTypeName, ValueType> gtl::IntType< IntTypeName, _ValueType >::ThisType

Definition at line 187 of file int_type.h.

◆ ValueType

template<typename IntTypeName , typename _ValueType >
_ValueType gtl::IntType< IntTypeName, _ValueType >::ValueType

Definition at line 186 of file int_type.h.

Constructor & Destructor Documentation

◆ IntType() [1/2]

template<typename IntTypeName , typename _ValueType >
gtl::IntType< IntTypeName, _ValueType >::IntType ( )
inlineconstexpr

Default c'tor initializing value_ to 0.

Definition at line 203 of file int_type.h.

◆ IntType() [2/2]

template<typename IntTypeName , typename _ValueType >
gtl::IntType< IntTypeName, _ValueType >::IntType ( ValueType value)
inlineexplicitconstexpr

C'tor explicitly initializing from a ValueType.

Definition at line 205 of file int_type.h.

Member Function Documentation

◆ INT_TYPE_ASSIGNMENT_OP() [1/5]

template<typename IntTypeName , typename _ValueType >
gtl::IntType< IntTypeName, _ValueType >::INT_TYPE_ASSIGNMENT_OP ( % )

◆ INT_TYPE_ASSIGNMENT_OP() [2/5]

template<typename IntTypeName , typename _ValueType >
gtl::IntType< IntTypeName, _ValueType >::INT_TYPE_ASSIGNMENT_OP ( + )

◆ INT_TYPE_ASSIGNMENT_OP() [3/5]

template<typename IntTypeName , typename _ValueType >
gtl::IntType< IntTypeName, _ValueType >::INT_TYPE_ASSIGNMENT_OP ( - )

◆ INT_TYPE_ASSIGNMENT_OP() [4/5]

template<typename IntTypeName , typename _ValueType >
INT_TYPE_ASSIGNMENT_OP * gtl::IntType< IntTypeName, _ValueType >::INT_TYPE_ASSIGNMENT_OP ( / )

◆ INT_TYPE_ASSIGNMENT_OP() [5/5]

template<typename IntTypeName , typename _ValueType >
gtl::IntType< IntTypeName, _ValueType >::INT_TYPE_ASSIGNMENT_OP ( >= )

◆ operator!()

template<typename IntTypeName , typename _ValueType >
bool gtl::IntType< IntTypeName, _ValueType >::operator! ( ) const
inlineconstexpr

Definition at line 242 of file int_type.h.

◆ operator+()

template<typename IntTypeName , typename _ValueType >
const ThisType gtl::IntType< IntTypeName, _ValueType >::operator+ ( ) const
inlineconstexpr

Definition at line 243 of file int_type.h.

◆ operator++() [1/2]

template<typename IntTypeName , typename _ValueType >
ThisType & gtl::IntType< IntTypeName, _ValueType >::operator++ ( )
inline

– UNARY OPERATORS -----------------------------------------------------—

Definition at line 223 of file int_type.h.

◆ operator++() [2/2]

template<typename IntTypeName , typename _ValueType >
const ThisType gtl::IntType< IntTypeName, _ValueType >::operator++ ( int v)
inline

Definition at line 227 of file int_type.h.

◆ operator-()

template<typename IntTypeName , typename _ValueType >
const ThisType gtl::IntType< IntTypeName, _ValueType >::operator- ( ) const
inlineconstexpr

Definition at line 244 of file int_type.h.

◆ operator--() [1/2]

template<typename IntTypeName , typename _ValueType >
ThisType & gtl::IntType< IntTypeName, _ValueType >::operator-- ( )
inline

Definition at line 232 of file int_type.h.

◆ operator--() [2/2]

template<typename IntTypeName , typename _ValueType >
const ThisType gtl::IntType< IntTypeName, _ValueType >::operator-- ( int v)
inline

Definition at line 236 of file int_type.h.

◆ operator=()

template<typename IntTypeName , typename _ValueType >
ThisType & gtl::IntType< IntTypeName, _ValueType >::operator= ( ValueType arg_value)
inline

Definition at line 268 of file int_type.h.

◆ operator~()

template<typename IntTypeName , typename _ValueType >
const ThisType gtl::IntType< IntTypeName, _ValueType >::operator~ ( ) const
inlineconstexpr

Definition at line 245 of file int_type.h.

◆ TypeName()

template<typename IntTypeName , typename _ValueType >
static constexpr absl::string_view gtl::IntType< IntTypeName, _ValueType >::TypeName ( )
inlinestaticconstexpr

Definition at line 189 of file int_type.h.

◆ value() [1/2]

template<typename IntTypeName , typename _ValueType >
ValueType gtl::IntType< IntTypeName, _ValueType >::value ( ) const
inlineconstexpr

IntType uses the default copy constructor, destructor and assign operator. The defaults are sufficient and omitting them allows the compiler to add the move constructor/assignment. – ACCESSORS -----------------------------------------------------------— The class provides a value() accessor returning the stored ValueType value_ as well as a templatized accessor that is just a syntactic sugar for static_cast<T>(var.value());

Definition at line 215 of file int_type.h.

◆ value() [2/2]

template<typename IntTypeName , typename _ValueType >
template<typename ValType >
ValType gtl::IntType< IntTypeName, _ValueType >::value ( ) const
inlineconstexpr

Definition at line 218 of file int_type.h.


The documentation for this class was generated from the following file: