2 #ifndef SYDEVS_IDENTITY_H_
3 #define SYDEVS_IDENTITY_H_
54 constexpr
identity(
const identity&) =
default;
55 identity&
operator=(
const identity&) =
default;
57 identity&
operator=(identity&&) =
default;
60 constexpr
bool valid()
const;
71 constexpr
const identity
operator+()
const;
78 constexpr
bool operator<(identity rhs)
const;
79 constexpr
bool operator>(identity rhs)
const;
108 return index_ != nan_int64;
197 return index_ == rhs.index_;
204 return index_ != rhs.index_;
211 return index_ < rhs.index_;
218 return index_ > rhs.index_;
225 return index_ <= rhs.index_;
232 return index_ >= rhs.index_;
244 inline std::ostream& operator<<(std::ostream& os, const identity<U>& rhs)
250 os <<
"{" << rhs.
index() <<
"}";
arraynd< T, ndims > operator+(const arraynd< T, ndims > &rhs)
Definition: arraynd.h:724
constexpr identity()
Constructs an invalid identity value.
Definition: identity.h:92
static constexpr int64 nan_int64
Definition: identity.h:84
constexpr bool operator<(identity rhs) const
Returns true if the identity value is less than rhs.
Definition: identity.h:209
constexpr bool operator!=(identity rhs) const
Returns true if the identity value does not equal rhs.
Definition: identity.h:202
constexpr bool operator>(identity rhs) const
Returns true if the identity value is greater than rhs.
Definition: identity.h:216
constexpr int64 index() const
Returns the internal index.
Definition: identity.h:113
constexpr bool operator>=(identity rhs) const
Returns true if the identity value is at least rhs.
Definition: identity.h:230
identity & operator-=(int64 rhs)
Subtracts rhs from the identity value.
Definition: identity.h:166
constexpr bool valid() const
Returns true if the identity value is valid.
Definition: identity.h:106
constexpr const identity operator+() const
Returns a copy of the identity value.
Definition: identity.h:174
constexpr bool operator<=(identity rhs) const
Returns true if the identity value is at most rhs.
Definition: identity.h:223
~identity()=default
Destructor.
identity & operator++()
Increments (prefix) the internal index.
Definition: identity.h:120
A data type which identifies an item by combining an encapsulated integer-valued index with a dimensi...
Definition: identity.h:41
constexpr bool operator==(identity rhs) const
Returns true if the identity value equals rhs.
Definition: identity.h:195
constexpr const identity operator-(int64 rhs) const
Returns a new identity value with rhs subtracted.
Definition: identity.h:188
identity & operator=(const identity &)=default
Copy assignment.
int64_t int64
Definition: number_types.h:14
identity & operator+=(int64 rhs)
Adds rhs to the identity value.
Definition: identity.h:158
identity & operator--()
Decrements (prefix) the internal index.
Definition: identity.h:139