OR-Tools  8.2
int_type.h File Reference

Go to the source code of this file.

Classes

class  IntType< IntTypeName, _ValueType >
 
struct  IntType< IntTypeName, _ValueType >::Hasher
 
struct  hash< gtl::IntType< IntTypeName, ValueType > >
 

Namespaces

namespace  gtl
 
namespace  std
 STL namespace.
 

Macros

#define DEFINE_INT_TYPE(int_type_name, value_type)
 
#define INT_TYPE_ASSIGNMENT_OP(op)
 
#define INT_TYPE_ARITHMETIC_OP(op)
 
#define INT_TYPE_COMPARISON_OP(op)
 

Functions

template<typename IntTypeName , typename ValueType >
std::ostream & operator<< (std::ostream &os, IntType< IntTypeName, ValueType > arg)
 
 INT_TYPE_ARITHMETIC_OP (+)
 
 INT_TYPE_ARITHMETIC_OP (-)
 
INT_TYPE_ARITHMETIC_OP * INT_TYPE_ARITHMETIC_OP (/);INT_TYPE_ARITHMETIC_OP(<<
 
 INT_TYPE_ARITHMETIC_OP (> >)
 
 INT_TYPE_ARITHMETIC_OP (%)
 
 INT_TYPE_COMPARISON_OP (==)
 
 INT_TYPE_COMPARISON_OP (!=)
 
 INT_TYPE_COMPARISON_OP (<=)
 
 INT_TYPE_COMPARISON_OP (>=)
 

Variables

class gtl::IntType ABSL_ATTRIBUTE_PACKED
 

Macro Definition Documentation

◆ DEFINE_INT_TYPE

#define DEFINE_INT_TYPE (   int_type_name,
  value_type 
)
Value:
struct int_type_name##_tag_ { \
static constexpr absl::string_view TypeName() { return #int_type_name; } \
}; \
typedef ::gtl::IntType<int_type_name##_tag_, value_type> int_type_name;

Definition at line 166 of file int_type.h.

◆ INT_TYPE_ARITHMETIC_OP

#define INT_TYPE_ARITHMETIC_OP (   op)
Value:
template <typename IntTypeName, typename ValueType> \
constexpr IntType<IntTypeName, ValueType> operator op( \
IntType<IntTypeName, ValueType> id_1, \
IntType<IntTypeName, ValueType> id_2) { \
return IntType<IntTypeName, ValueType>(id_1.value() op id_2.value()); \
} \
template <typename IntTypeName, typename ValueType> \
constexpr IntType<IntTypeName, ValueType> operator op( \
IntType<IntTypeName, ValueType> id, \
typename IntType<IntTypeName, ValueType>::ValueType arg_val) { \
return IntType<IntTypeName, ValueType>(id.value() op arg_val); \
} \
template <typename IntTypeName, typename ValueType> \
constexpr IntType<IntTypeName, ValueType> operator op( \
typename IntType<IntTypeName, ValueType>::ValueType arg_val, \
IntType<IntTypeName, ValueType> id) { \
return IntType<IntTypeName, ValueType>(arg_val op id.value()); \
}
int64 value

Definition at line 295 of file int_type.h.

◆ INT_TYPE_ASSIGNMENT_OP

#define INT_TYPE_ASSIGNMENT_OP (   op)
Value:
ThisType& operator op(const ThisType& arg_value) { \
value_ op arg_value.value(); \
return *this; \
} \
ThisType& operator op(ValueType arg_value) { \
value_ op arg_value; \
return *this; \
}

Definition at line 248 of file int_type.h.

◆ INT_TYPE_COMPARISON_OP

#define INT_TYPE_COMPARISON_OP (   op)
Value:
template <typename IntTypeName, typename ValueType> \
static inline constexpr bool operator op( \
IntType<IntTypeName, ValueType> id_1, \
IntType<IntTypeName, ValueType> id_2) { \
return id_1.value() op id_2.value(); \
} \
template <typename IntTypeName, typename ValueType> \
static inline constexpr bool operator op( \
IntType<IntTypeName, ValueType> id, \
typename IntType<IntTypeName, ValueType>::ValueType val) { \
return id.value() op val; \
} \
template <typename IntTypeName, typename ValueType> \
static inline constexpr bool operator op( \
typename IntType<IntTypeName, ValueType>::ValueType val, \
IntType<IntTypeName, ValueType> id) { \
return val op id.value(); \
}

Definition at line 329 of file int_type.h.