GDBserver
Macros | Functions
offset-type.h File Reference

Go to the source code of this file.

Macros

#define DEFINE_OFFSET_TYPE(TYPE, UNDERLYING)
 
#define DEFINE_OFFSET_REL_OP(OP)
 
#define DEFINE_OFFSET_ARITHM_OP(OP)
 

Functions

template<typename E , typename = decltype (is_offset_type (std::declval<E> ()))>
constexpr std::underlying_type< E >::type operator+ (E lhs, E rhs)=delete
 
template<typename E , typename = decltype (is_offset_type (std::declval<E> ()))>
constexpr std::underlying_type< E >::type operator- (E lhs, E rhs)
 

Macro Definition Documentation

◆ DEFINE_OFFSET_ARITHM_OP

#define DEFINE_OFFSET_ARITHM_OP (   OP)
Value:
template<typename E, \
typename = decltype (is_offset_type (std::declval<E> ()))> \
constexpr E \
operator OP (E lhs, typename std::underlying_type<E>::type rhs) \
{ \
using underlying = typename std::underlying_type<E>::type; \
return (E) (static_cast<underlying> (lhs) OP rhs); \
} \
\
template<typename E, \
typename = decltype (is_offset_type (std::declval<E> ()))> \
constexpr E \
operator OP (typename std::underlying_type<E>::type lhs, E rhs) \
{ \
using underlying = typename std::underlying_type<E>::type; \
return (E) (lhs OP static_cast<underlying> (rhs)); \
} \
\
template<typename E, \
typename = decltype (is_offset_type (std::declval<E> ()))> \
E & \
operator OP ## = (E &lhs, typename std::underlying_type<E>::type rhs) \
{ \
using underlying = typename std::underlying_type<E>::type; \
lhs = (E) (static_cast<underlying> (lhs) OP rhs); \
return lhs; \
}

Definition at line 95 of file offset-type.h.

◆ DEFINE_OFFSET_REL_OP

#define DEFINE_OFFSET_REL_OP (   OP)
Value:
template<typename E, \
typename = decltype (is_offset_type (std::declval<E> ()))> \
constexpr bool \
operator OP (E lhs, E rhs) \
{ \
using underlying = typename std::underlying_type<E>::type; \
return (static_cast<underlying> (lhs) \
OP static_cast<underlying> (lhs)); \
}

Definition at line 76 of file offset-type.h.

◆ DEFINE_OFFSET_TYPE

#define DEFINE_OFFSET_TYPE (   TYPE,
  UNDERLYING 
)
Value:
enum class TYPE : UNDERLYING {}; \
void is_offset_type (TYPE)

Definition at line 53 of file offset-type.h.

Function Documentation

◆ operator+()

template<typename E , typename = decltype (is_offset_type (std::declval<E> ()))>
constexpr std::underlying_type<E>::type operator+ ( lhs,
rhs 
)
delete

◆ operator-()

template<typename E , typename = decltype (is_offset_type (std::declval<E> ()))>
constexpr std::underlying_type<E>::type operator- ( lhs,
rhs 
)

Definition at line 143 of file offset-type.h.