Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::StrongIndex< StrongIndexName > Class Template Reference

#include <strong_integers.h>

Public Types

typedef int ValueType
 
typedef StrongIndex< StrongIndexName > ThisType
 

Public Member Functions

struct ABSL_DEPRECATED ("Use absl::Hash instead") Hasher
 
constexpr StrongIndex ()
 
constexpr StrongIndex (int value)
 
StrongIndexoperator= (int arg_value)
 
constexpr int value () const
 
template<typename ValType >
constexpr ValType value () const
 
constexpr ThisType operator+ () const
 
constexpr ThisType operator- () const
 
 STRONG_ASSIGNMENT_OP (StrongIndex, int,+=)
 
 STRONG_ASSIGNMENT_OP (StrongIndex, int, -=)
 

Static Public Member Functions

static constexpr absl::string_view TypeName ()
 

Public Attributes

 INCREMENT_AND_DECREMENT_OPERATORS
 

Detailed Description

template<typename StrongIndexName>
class operations_research::StrongIndex< StrongIndexName >

Holds an int value and behaves as an int by exposing assignment, unary, comparison, and arithmetic operators.

The template parameter StrongIndexName defines the name for the int type and must be unique within a binary (the convenient DEFINE_STRONG_INDEX_TYPE macro at the start of the file generates a unique StrongIndexName).

This class is NOT thread-safe.

Definition at line 137 of file strong_integers.h.

Member Typedef Documentation

◆ ThisType

template<typename StrongIndexName >
StrongIndex<StrongIndexName> operations_research::StrongIndex< StrongIndexName >::ThisType

Definition at line 140 of file strong_integers.h.

◆ ValueType

template<typename StrongIndexName >
int operations_research::StrongIndex< StrongIndexName >::ValueType

Definition at line 139 of file strong_integers.h.

Constructor & Destructor Documentation

◆ StrongIndex() [1/2]

template<typename StrongIndexName >
operations_research::StrongIndex< StrongIndexName >::StrongIndex ( )
inlineconstexpr

Definition at line 152 of file strong_integers.h.

◆ StrongIndex() [2/2]

template<typename StrongIndexName >
operations_research::StrongIndex< StrongIndexName >::StrongIndex ( int value)
inlineexplicitconstexpr

Definition at line 154 of file strong_integers.h.

Member Function Documentation

◆ ABSL_DEPRECATED()

template<typename StrongIndexName >
struct operations_research::StrongIndex< StrongIndexName >::ABSL_DEPRECATED ( "Use absl::Hash instead" )
inline

Definition at line 142 of file strong_integers.h.

◆ operator+()

template<typename StrongIndexName >
ThisType operations_research::StrongIndex< StrongIndexName >::operator+ ( ) const
inlineconstexpr

Definition at line 171 of file strong_integers.h.

◆ operator-()

template<typename StrongIndexName >
ThisType operations_research::StrongIndex< StrongIndexName >::operator- ( ) const
inlineconstexpr

Definition at line 172 of file strong_integers.h.

◆ operator=()

template<typename StrongIndexName >
StrongIndex & operations_research::StrongIndex< StrongIndexName >::operator= ( int arg_value)
inline

Definition at line 156 of file strong_integers.h.

◆ STRONG_ASSIGNMENT_OP() [1/2]

template<typename StrongIndexName >
operations_research::StrongIndex< StrongIndexName >::STRONG_ASSIGNMENT_OP ( StrongIndex< StrongIndexName > ,
int ,
-  )

◆ STRONG_ASSIGNMENT_OP() [2/2]

template<typename StrongIndexName >
operations_research::StrongIndex< StrongIndexName >::STRONG_ASSIGNMENT_OP ( StrongIndex< StrongIndexName > ,
int ,
+  )

◆ TypeName()

template<typename StrongIndexName >
static constexpr absl::string_view operations_research::StrongIndex< StrongIndexName >::TypeName ( )
inlinestaticconstexpr

Definition at line 142 of file strong_integers.h.

◆ value() [1/2]

template<typename StrongIndexName >
int operations_research::StrongIndex< StrongIndexName >::value ( ) const
inlineconstexpr

The class provides a value() accessor returning the stored int value_ as well as a templatized accessor that is just a syntactic sugar for static_cast<T>(var.value());

Definition at line 164 of file strong_integers.h.

◆ value() [2/2]

template<typename StrongIndexName >
template<typename ValType >
ValType operations_research::StrongIndex< StrongIndexName >::value ( ) const
inlineconstexpr

Definition at line 167 of file strong_integers.h.

Member Data Documentation

◆ INCREMENT_AND_DECREMENT_OPERATORS

template<typename StrongIndexName >
operations_research::StrongIndex< StrongIndexName >::INCREMENT_AND_DECREMENT_OPERATORS

Definition at line 174 of file strong_integers.h.


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