-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpairwise.cpp
More file actions
122 lines (93 loc) · 3.92 KB
/
Copy pathpairwise.cpp
File metadata and controls
122 lines (93 loc) · 3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// Logicwise
// Copyright (c) 2026 Frog Singing (@frog-singing)
// SPDX-License-Identifier: MIT
#include <logicwise.h>
#include <iostream> // std::cout, std::endl
namespace logicwise::test
{
template<typename index_sequence>
static void print()
{
if constexpr (wrapper::as_value_list<index_sequence>::empty)
{
std::cout << "empty index sequence" << std::endl;
}
else
{
using index_type = detail::IndexTrait2D::index_type;
index_sequence::invoke([] <index_type Head, index_type... Tail> {
std::cout << "(" << Head[0] << ", " << Head[1] << ")";
(..., (std::cout << ", (" << Tail[0] << ", " << Tail[1] << ")"));
std::cout << std::endl;
});
}
}
}
int main()
{
using namespace logicwise;
using namespace logicwise::detail; // for Extent1D and index_sequencer
using namespace logicwise::test;
//--------------------------------------------------------------------------------
static constexpr Extent1D extent{ 4 };
// try to replace extent with other non-negative integers
using forward_index_sequence_for_permutation_pair = index_sequencer<
arrangement::permutation_pair,
arrangement::permutation_pair::forward_index_traverser,
extent
>::index_sequence;
using reverse_index_sequence_for_permutation_pair = index_sequencer<
arrangement::permutation_pair,
arrangement::permutation_pair::reverse_index_traverser,
extent
>::index_sequence;
using forward_index_sequence_for_combination_pair = index_sequencer<
arrangement::combination_pair,
arrangement::combination_pair::forward_index_traverser,
extent
>::index_sequence;
using reverse_index_sequence_for_combination_pair = index_sequencer<
arrangement::combination_pair,
arrangement::combination_pair::reverse_index_traverser,
extent
>::index_sequence;
using forward_index_sequence_for_linear_adjacent_pair = index_sequencer<
arrangement::linear_adjacent_pair,
arrangement::linear_adjacent_pair::forward_index_traverser,
extent
>::index_sequence;
using reverse_index_sequence_for_linear_adjacent_pair = index_sequencer<
arrangement::linear_adjacent_pair,
arrangement::linear_adjacent_pair::reverse_index_traverser,
extent
>::index_sequence;
using forward_index_sequence_for_circular_adjacent_pair = index_sequencer<
arrangement::circular_adjacent_pair,
arrangement::circular_adjacent_pair::forward_index_traverser,
extent
>::index_sequence;
using reverse_index_sequence_for_circular_adjacent_pair = index_sequencer<
arrangement::circular_adjacent_pair,
arrangement::circular_adjacent_pair::reverse_index_traverser,
extent
>::index_sequence;
//--------------------------------------------------------------------------------
std::cout << "Extent: " << extent.i() << std::endl;
std::cout << std::endl << "Forward index sequence for permutation pair: " << std::endl;
print<forward_index_sequence_for_permutation_pair>();
std::cout << std::endl << "Reverse index sequence for permutation pair: " << std::endl;
print<reverse_index_sequence_for_permutation_pair>();
std::cout << std::endl << "Forward index sequence for combination pair: " << std::endl;
print<forward_index_sequence_for_combination_pair>();
std::cout << std::endl << "Reverse index sequence for combination pair: " << std::endl;
print<reverse_index_sequence_for_combination_pair>();
std::cout << std::endl << "Forward index sequence for linear adjacent pair: " << std::endl;
print<forward_index_sequence_for_linear_adjacent_pair>();
std::cout << std::endl << "Reverse index sequence for linear adjacent pair: " << std::endl;
print<reverse_index_sequence_for_linear_adjacent_pair>();
std::cout << std::endl << "Forward index sequence for circular adjacent pair: " << std::endl;
print<forward_index_sequence_for_circular_adjacent_pair>();
std::cout << std::endl << "Reverse index sequence for circular adjacent pair: " << std::endl;
print<reverse_index_sequence_for_circular_adjacent_pair>();
std::cout << std::endl << "Hello Logic!" << std::endl;
}