CNORXZ
Container with Native Operation Routines and Expressions
Loading...
Searching...
No Matches
index_id.cc.h
Go to the documentation of this file.
1// -*- C++ -*-
12#ifndef __cxz_index_id_cc_h__
13#define __cxz_index_id_cc_h__
14
15#include "index_id.h"
16
17namespace CNORXZ
18{
19
20 template <SizeT I>
21 constexpr IndexId<I>::IndexId(PtrId id) :
22 mId(id)
23 {}
24
25 template <SizeT I>
26 constexpr const PtrId& IndexId<I>::id() const
27 {
28 return mId;
29 }
31 template <SizeT I>
32 template <SizeT J>
33 constexpr decltype(auto) IndexId<I>::operator==(const IndexId<J>& a) const
34 {
35 if constexpr(I != 0 or J != 0){
36 if constexpr(I == J){
37 CXZ_ASSERT(mId == a.id(),
38 "got different index ids for equal static index label");
39 return true;
40 }
41 else {
42 CXZ_ASSERT(mId == a.id(),
43 "got equal index ids for different static index label");
44 return false;
45 }
46 }
47 else {
48 return mId == a.id();
49 }
50 }
51
52 template <SizeT I>
53 template <SizeT J>
54 constexpr decltype(auto) IndexId<I>::operator!=(const IndexId<J>& a) const
55 {
56 if constexpr(I != 0 and J != 0){
57 if constexpr(I == J){
58 CXZ_ASSERT(mId == a.id(),
59 "got different index ids for equal static index label");
60 return false;
61 }
62 else {
63 CXZ_ASSERT(mId == a.id(),
64 "got equal index ids for different static index label");
65 return true;
66 }
67 }
68 else {
69 return mId != a.id();
70 }
71 }
72
73}
74
75#endif
#define CXZ_ASSERT(statement, errmsg)
Definition assert.h:40
constexpr const PtrId & id() const
Definition index_id.cc.h:26
constexpr IndexId(PtrId id)
Definition index_id.cc.h:21
Index ID type declarations.
std::intptr_t PtrId
Definition types.h:35
Sptr< Range > rangeCast(const RangePtr r)