Celeritas 0.6.0-dev.116+3fbab5e0
Loading...
Searching...
No Matches
Classes | Macros | Functions
OpaqueId.hh File Reference
#include <cstddef>
#include <functional>
#include <type_traits>
#include "Assert.hh"
#include "Macros.hh"
#include "Types.hh"
This graph shows which files directly or indirectly include this file:

Classes

class  celeritas::OpaqueId< ValueT, SizeT >
 Type-safe index for accessing an array or collection of data. More...
 

Macros

#define CELER_DEFINE_OPAQUEID_CMP(TOKEN)
 

Functions

template<class IdT , class T >
IdT celeritas::id_cast (T value) noexcept(!CELERITAS_DEBUG)
 Safely create an OpaqueId from an integer of any type.
 
template<class V , class S , class U >
constexpr bool celeritas::operator< (OpaqueId< V, S > lhs, U rhs)
 Allow less-than comparison with integer for container comparison.
 
template<class V , class S , class U >
constexpr bool celeritas::operator<= (OpaqueId< V, S > lhs, U rhs)
 Allow less-than-equal comparison with integer for container comparison.
 
template<class V , class S >
S celeritas::operator- (OpaqueId< V, S > self, OpaqueId< V, S > other)
 Get the distance between two opaque IDs.
 
template<class V , class S >
OpaqueId< V, Sceleritas::operator+ (OpaqueId< V, S > id, std::make_signed_t< S > offset)
 Increment an opaque ID by an offset.
 
template<class V , class S >
OpaqueId< V, Sceleritas::operator- (OpaqueId< V, S > id, std::make_signed_t< S > offset)
 Decrement an opaque ID by an offset.
 
template<class V , class S >
constexpr bool celeritas::operator== (OpaqueId< V, S > lhs, OpaqueId< V, S > rhs)
 
template<class V , class S >
constexpr bool celeritas::operator!= (OpaqueId< V, S > lhs, OpaqueId< V, S > rhs)
 
template<class V , class S >
constexpr bool celeritas::operator< (OpaqueId< V, S > lhs, OpaqueId< V, S > rhs)
 
template<class V , class S >
constexpr bool celeritas::operator> (OpaqueId< V, S > lhs, OpaqueId< V, S > rhs)
 
template<class V , class S >
constexpr bool celeritas::operator<= (OpaqueId< V, S > lhs, OpaqueId< V, S > rhs)
 
template<class V , class S >
constexpr bool celeritas::operator>= (OpaqueId< V, S > lhs, OpaqueId< V, S > rhs)
 

Macro Definition Documentation

◆ CELER_DEFINE_OPAQUEID_CMP

#define CELER_DEFINE_OPAQUEID_CMP (   TOKEN)
Value:
template<class V, class S> \
CELER_CONSTEXPR_FUNCTION bool operator TOKEN(OpaqueId<V, S> lhs, \
OpaqueId<V, S> rhs) \
{ \
return lhs.unchecked_get() TOKEN rhs.unchecked_get(); \
}
#define CELER_CONSTEXPR_FUNCTION
Decorate a function that works on both host and device, with and without NVCC, can be evaluated at co...
Definition Macros.hh:80

Function Documentation

◆ id_cast()

template<class IdT , class T >
IdT celeritas::id_cast ( T  value)
inlinenoexcept

Safely create an OpaqueId from an integer of any type.

This asserts that the integer is in the valid range of the target ID type, and casts to it.

Note
The value cannot be the underlying "invalid" value, i.e. static_cast<FooId>(FooId{}.unchecked_get()) will not work.

◆ operator!=()

template<class V , class S >
constexpr bool celeritas::operator!= ( OpaqueId< V, S lhs,
OpaqueId< V, S rhs 
)
inlineconstexpr

Comparison for OpaqueId

◆ operator<()

template<class V , class S >
constexpr bool celeritas::operator< ( OpaqueId< V, S lhs,
OpaqueId< V, S rhs 
)
inlineconstexpr

Comparison for OpaqueId

◆ operator<=()

template<class V , class S >
constexpr bool celeritas::operator<= ( OpaqueId< V, S lhs,
OpaqueId< V, S rhs 
)
inlineconstexpr

Comparison for OpaqueId

◆ operator==()

template<class V , class S >
constexpr bool celeritas::operator== ( OpaqueId< V, S lhs,
OpaqueId< V, S rhs 
)
inlineconstexpr

Comparison for OpaqueId

◆ operator>()

template<class V , class S >
constexpr bool celeritas::operator> ( OpaqueId< V, S lhs,
OpaqueId< V, S rhs 
)
inlineconstexpr

Comparison for OpaqueId

◆ operator>=()

template<class V , class S >
constexpr bool celeritas::operator>= ( OpaqueId< V, S lhs,
OpaqueId< V, S rhs 
)
inlineconstexpr

Comparison for OpaqueId