23 constexpr Id() noexcept : id_( -1 ) { }
24 explicit Id( NoInit )
noexcept { }
33 template <
typename U =
int
37 >
requires std::is_integral_v<U>
39 , std::enable_if_t<std::is_integral_v<U>, std::nullptr_t> =
nullptr>
41 explicit constexpr Id( U i ) noexcept : id_(
ValueType( i ) ) { }
43 constexpr operator ValueType()
const {
return id_; }
44 constexpr bool valid()
const {
return id_ >= 0; }
45 explicit constexpr operator bool()
const {
return id_ >= 0; }
62 constexpr Id operator --(
int ) {
auto res = *
this; --id_;
return res; }
63 constexpr Id operator ++(
int ) {
auto res = *
this; ++id_;
return res; }
70#if !MR_PARSING_FOR_C_BINDINGS && !MR_COMPILING_C_BINDINGS
92 constexpr Id() noexcept : id_( -1 ) { }
93 explicit Id( NoInit )
noexcept { }
94 constexpr Id( UndirectedEdgeId u ) noexcept : id_( (
ValueType)u << 1 ) { assert( u.valid() ); }
96 explicit constexpr Id(
unsigned int i ) noexcept : id_( i ) { }
97 explicit constexpr Id(
size_t i ) noexcept : id_(
ValueType( i ) ) { }
98 constexpr operator ValueType()
const {
return id_; }
99 constexpr bool valid()
const {
return id_ >= 0; }
100 explicit constexpr operator bool()
const {
return id_ >= 0; }
106 constexpr bool even()
const { assert(
valid() );
return (id_ & 1) == 0; }
107 constexpr bool odd()
const { assert(
valid() );
return (id_ & 1) == 1; }
109 constexpr UndirectedEdgeId
undirected()
const { assert(
valid() );
return UndirectedEdgeId( id_ >> 1 ); }
110 constexpr operator UndirectedEdgeId()
const {
return undirected(); }
116 template <
typename U>
118 template <
typename U>
120 template <
typename U>
133#if !MR_PARSING_FOR_C_BINDINGS && !MR_COMPILING_C_BINDINGS
147 explicit Id( NoInit )
noexcept { }
149 explicit constexpr Id(
int )
noexcept =
delete;
152 explicit constexpr operator bool()
const {
return id_ !=
~ValueType( 0 ); }
159 template <
typename U>
161 template <
typename U>
163 template <
typename U>
176#if !MR_PARSING_FOR_C_BINDINGS && !MR_COMPILING_C_BINDINGS
197inline constexpr FaceId
operator ""_f(
unsigned long long i )
noexcept {
return FaceId{ (int)i }; }
198inline constexpr VertId
operator ""_v(
unsigned long long i )
noexcept {
return VertId{ (int)i }; }
199inline constexpr EdgeId
operator ""_e(
unsigned long long i )
noexcept {
return EdgeId{ (int)i }; }
200inline constexpr UndirectedEdgeId
operator ""_ue(
unsigned long long i )
noexcept {
return UndirectedEdgeId{ (int)i }; }
201inline constexpr VoxelId
operator ""_vox(
unsigned long long i )
noexcept {
return VoxelId{ size_t( i ) }; }
206struct std::hash<
MR::Id<T>>
208 size_t operator() (
MR::Id<T> const& p )
const noexcept
stores index of some element, it is made as template class to avoid mixing faces, edges and vertices
Definition MRId.h:19
Variant of Id<T> with omitted initialization by default. Useful for containers.
Definition MRId.h:80
BitSet operator-(const BitSet &a, const BitSet &b)
Definition MRBitSet.h:457
constexpr bool odd() const
Definition MRId.h:107
constexpr bool valid() const
Definition MRId.h:151
size_t ValueType
Definition MRId.h:144
constexpr ValueType & get() noexcept
Definition MRId.h:153
constexpr Id() noexcept
the type used for internal representation of Id
Definition MRId.h:146
constexpr bool valid() const
Definition MRId.h:99
constexpr bool operator!=(Id b) const
Definition MRId.h:49
constexpr Id & operator+=(ValueType a)
Definition MRId.h:66
constexpr Id & operator++()
Definition MRId.h:60
int ValueType
Definition MRId.h:90
NoInitId()
Definition MRId.h:82
constexpr Id sym() const
returns identifier of the edge with same ends but opposite orientation
Definition MRId.h:104
Id(NoInit) noexcept
Definition MRId.h:24
constexpr bool operator==(Id b) const
Definition MRId.h:48
Id(NoInit) noexcept
Definition MRId.h:93
constexpr bool valid() const
Definition MRId.h:44
constexpr Id(UndirectedEdgeId u) noexcept
Definition MRId.h:94
constexpr Id(ValueType i) noexcept
Definition MRId.h:95
constexpr Id & operator-=(ValueType a)
Definition MRId.h:65
constexpr Id & operator--()
Definition MRId.h:59
Id(NoInit) noexcept
Definition MRId.h:147
constexpr Id(int) noexcept=delete
constexpr Id() noexcept
the type used for internal representation of Id
Definition MRId.h:23
NoInitId(Id< T > id)
Definition MRId.h:83
constexpr Id(ValueType i) noexcept
Definition MRId.h:148
constexpr bool operator<(Id b) const
Definition MRId.h:50
constexpr ValueType & get() noexcept
Definition MRId.h:46
constexpr Id(size_t i) noexcept
Definition MRId.h:97
constexpr Id() noexcept
the type used for internal representation of Id
Definition MRId.h:92
int ValueType
Definition MRId.h:21
constexpr Id(unsigned int i) noexcept
Definition MRId.h:96
constexpr Id(U i) noexcept
Definition MRId.h:41
constexpr ValueType & get() noexcept
Definition MRId.h:101
constexpr bool even() const
among each pair of sym-edges: one is always even and the other is odd
Definition MRId.h:106
constexpr UndirectedEdgeId undirected() const
returns unique identifier of the edge ignoring its direction
Definition MRId.h:109
Color operator+(const Color &a, const Color &b)
Definition MRColor.h:109
only for bindings generation
Definition MRCameraOrientationPlugin.h:8