-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructs.hpp
More file actions
201 lines (156 loc) · 3.51 KB
/
structs.hpp
File metadata and controls
201 lines (156 loc) · 3.51 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/**
* clang-style definition for LAL
* Copyright (C) 2024 - 2026 Lluís Alemany Puig
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Contact:
*
* Lluís Alemany Puig (lluis.alemany.puig@upc.edu)
* LQMC (Quantitative, Mathematical, and Computational Linguisitcs)
* CQL (Complexity and Quantitative Linguistics Lab)
* Jordi Girona St 1-3, Campus Nord UPC, 08034 Barcelona. CATALONIA, SPAIN
* Webpage: https://cqllab.upc.edu/people/lalemany/
*/
#pragma once
// C++ includes
#include <string>
struct empty_struct { };
struct foo {
public:
foo() noexcept
: m_j(0),
m_i(9)
{ }
foo(const foo& f) noexcept = default;
foo(foo&& f) noexcept = default;
foo& operator= (const foo& f) noexcept = default;
foo& operator= (foo&& f) noexcept = delete;
~foo() noexcept = default;
struct nested_struct_2 {
public:
protected:
private:
};
protected:
template <typename T>
void do_something([[maybe_unused]] const T& t) noexcept
{ }
/// Documentation of member @e m_j
int m_j;
/* comment */
struct nested_struct_1 {
public:
protected:
private:
};
private:
/// Documentation of member @e m_i
int m_i;
struct nested_struct_3 {
public:
protected:
private:
};
[[nodiscard]] inline static constexpr int
function_with_a_long_name() noexcept
{
return 1;
}
};
struct foo_2 {
public:
foo_2(
int param1,
int param2,
[[maybe_unused]] int param3,
[[maybe_unused]] int param4
) noexcept
: m_j(param1),
m_i(param2)
{ }
struct nested_struct_2 {
public:
protected:
private:
};
protected:
/// Documentation of member @e m_j
int m_j;
/* comment */
struct nested_struct_1 {
public:
protected:
private:
};
private:
/// Documentation of member @e m_i
int m_i;
struct nested_struct_3 {
public:
protected:
private:
};
};
struct S1 {
int a;
float b;
std::string s;
};
S1 return_struct_1() noexcept
{
return S1{.a = 2, .b = 4.0, .s = "asdf"};
}
struct S2 {
int aaaaaaaaaaaaaaaaaaaaaa;
float bbbbbbbbbbbbbbbbbbbbbbbb;
std::string ssssssssssssssssssssss;
S2& something() noexcept
{
return *this;
}
};
S2 return_struct_2() noexcept
{
return S2{
.aaaaaaaaaaaaaaaaaaaaaa = 2,
.bbbbbbbbbbbbbbbbbbbbbbbb = 4.0,
.ssssssssssssssssssssss = "asdf"
};
}
void do_something() noexcept
{
S2 s1;
s1.something().something().something().something();
s1.something().something().something().something().something();
s1.something().something().something().something().something().something();
s1.something()
.something()
.something()
.something()
.something()
.something()
.something();
auto s2 = return_struct_2();
s2.something().something().something().something();
s2.something().something().something().something().something();
s2.something().something().something().something().something().something();
s2.something()
.something()
.something()
.something()
.something()
.something()
.something();
}