Tatooine
index.h
Go to the documentation of this file.
1#ifndef TATOOINE_EINSTEIN_NOTATION_INDEX_H
2#define TATOOINE_EINSTEIN_NOTATION_INDEX_H
3//==============================================================================
4#include <type_traits>
5//==============================================================================
7//==============================================================================
8template <std::size_t I>
9struct index_t {
10 static auto constexpr get() { return I; }
11};
12//==============================================================================
13[[maybe_unused]] static auto constexpr inline i = index_t<0>{};
14[[maybe_unused]] static auto constexpr inline j = index_t<1>{};
15[[maybe_unused]] static auto constexpr inline k = index_t<2>{};
16[[maybe_unused]] static auto constexpr inline l = index_t<3>{};
17[[maybe_unused]] static auto constexpr inline m = index_t<4>{};
18[[maybe_unused]] static auto constexpr inline n = index_t<5>{};
19[[maybe_unused]] static auto constexpr inline o = index_t<6>{};
20[[maybe_unused]] static auto constexpr inline p = index_t<7>{};
21[[maybe_unused]] static auto constexpr inline q = index_t<8>{};
22[[maybe_unused]] static auto constexpr inline r = index_t<9>{};
23[[maybe_unused]] static auto constexpr inline s = index_t<10>{};
24[[maybe_unused]] static auto constexpr inline t = index_t<11>{};
25[[maybe_unused]] static auto constexpr inline u = index_t<12>{};
26[[maybe_unused]] static auto constexpr inline v = index_t<13>{};
27[[maybe_unused]] static auto constexpr inline w = index_t<14>{};
28//==============================================================================
29template <typename T>
30struct is_index_impl : std::false_type {};
31//------------------------------------------------------------------------------
32template <std::size_t N>
33struct is_index_impl<index_t<N>> : std::true_type {};
34//------------------------------------------------------------------------------
35template <typename... Ts>
36static auto constexpr is_index = (is_index_impl<Ts>::value && ...);
37//------------------------------------------------------------------------------
38template <typename T>
39concept index = is_index<T>;
40//==============================================================================
41} // namespace tatooine::einstein_notation
42//==============================================================================
43#endif
Definition: added_contracted_dynamic_tensor.h:4
static auto constexpr u
Definition: index.h:25
static auto constexpr l
Definition: index.h:16
static auto constexpr i
Definition: index.h:13
static auto constexpr j
Definition: index.h:14
static auto constexpr w
Definition: index.h:27
static auto constexpr q
Definition: index.h:21
static auto constexpr n
Definition: index.h:18
static auto constexpr r
Definition: index.h:22
static auto constexpr v
Definition: index.h:26
static auto constexpr s
Definition: index.h:23
static auto constexpr k
Definition: index.h:15
static auto constexpr p
Definition: index.h:20
static auto constexpr m
Definition: index.h:17
static auto constexpr o
Definition: index.h:19
static auto constexpr is_index
Definition: index.h:36
static auto constexpr t
Definition: index.h:24
static auto constexpr get()
Definition: index.h:10