56typedef std::pair<node, node>
edge;
67#define __LAL_IS_INTEGRAL std::enable_if_t<std::is_integral_v<T>, bool> = true
77 node_t()
noexcept =
default;
79 template <
typename T, __LAL_IS_INTEGRAL>
80 node_t(
const T& _v) noexcept : value(_v) { }
84 template <
typename T, __LAL_IS_INTEGRAL>
85 node_t& operator= (
const T& _v)
noexcept { value = _v;
return *
this; }
89 template <
typename T, __LAL_IS_INTEGRAL>
90 bool operator== (
const T& t)
const noexcept {
return value == t; }
91 bool operator== (
const node_t& u)
const noexcept {
return value == u.value; }
92 template <
typename T, __LAL_IS_INTEGRAL>
93 friend bool operator== (
const T& t,
const node_t& u)
noexcept {
return u.value == t; }
95 template <
typename T, __LAL_IS_INTEGRAL>
96 bool operator!= (
const T& t)
const noexcept {
return value != t; }
97 bool operator!= (
const node_t& u)
const noexcept {
return value != u.value; }
98 template <
typename T, __LAL_IS_INTEGRAL>
99 friend bool operator!= (
const T& t,
const node_t& u)
noexcept {
return u.value != t; }
101 template <
typename T, __LAL_IS_INTEGRAL>
102 bool operator< (
const T& t)
const noexcept {
return value < t; }
103 bool operator< (
const node_t& u)
const noexcept {
return value < u.value; }
104 template <
typename T, __LAL_IS_INTEGRAL>
105 friend bool operator< (
const T& t,
const node_t& u)
noexcept {
return t < u.value; }
107 template <
typename T, __LAL_IS_INTEGRAL>
108 bool operator<= (
const T& t)
const noexcept {
return value <= t; }
109 bool operator<= (
const node_t& u)
const noexcept {
return value <= u.value; }
110 template <
typename T, __LAL_IS_INTEGRAL>
111 friend bool operator<= (
const T& t,
const node_t& u)
noexcept {
return t <= u.value; }
113 template <
typename T, __LAL_IS_INTEGRAL>
114 bool operator> (
const T& t)
const noexcept {
return value > t; }
115 bool operator> (
const node_t& u)
const noexcept {
return value > u.value; }
116 template <
typename T, __LAL_IS_INTEGRAL>
117 friend bool operator> (
const T& t,
const node_t& u)
noexcept {
return t > u.value; }
119 template <
typename T, __LAL_IS_INTEGRAL>
120 bool operator>= (
const T& t)
const noexcept {
return value >= t; }
121 bool operator>= (
const node_t& u)
const noexcept {
return value >= u.value; }
122 template <
typename T, __LAL_IS_INTEGRAL>
123 friend bool operator>= (
const T& t,
const node_t& u)
noexcept {
return t >= u.value; }
127 template <
typename T, __LAL_IS_INTEGRAL>
128 node_t operator+ (
const T& t)
const noexcept {
return node_t{value + t}; }
130 template <
typename T, __LAL_IS_INTEGRAL>
131 friend node_t operator+ (
const T& t,
const node_t& u)
noexcept {
return node_t{u.value + t}; }
133 template <
typename T, __LAL_IS_INTEGRAL>
134 node_t& operator+= (
const T& t)
noexcept { value += t;
return *
this; }
135 node_t& operator+= (
const node_t& u)
noexcept { value += u.value;
return *
this; }
137 template <
typename T, __LAL_IS_INTEGRAL>
138 node_t operator- (
const T& t)
const noexcept {
return node_t{value - t}; }
140 template <
typename T, __LAL_IS_INTEGRAL>
141 friend node_t operator- (
const T& t,
const node_t& u)
noexcept {
return node_t{t - u.value}; }
143 template <
typename T, __LAL_IS_INTEGRAL>
144 node_t& operator-= (
const T& t)
noexcept { value -= t;
return *
this; }
145 node_t& operator-= (
const node_t& u)
noexcept { value -= u.value;
return *
this; }
147 node_t& operator++()
noexcept { ++value;
return *
this; }
148 node_t& operator--()
noexcept { --value;
return *
this; }
152 template <
class stream>
153 friend stream& operator>> (stream& s,
node_t& p)
noexcept {
158 template <
class stream>
159 friend stream& operator<< (stream& s,
const node_t& p)
noexcept {
164 uint64_t operator*()
const noexcept {
return value; }
167static_assert( std::is_trivial_v<node_t>);
169static_assert( std::is_trivially_copyable_v<node_t>);
170static_assert( std::is_trivially_copy_assignable_v<node_t>);
171static_assert( std::is_copy_assignable_v<node_t>);
172static_assert( std::is_trivially_copy_constructible_v<node_t>);
173static_assert( std::is_copy_constructible_v<node_t>);
174static_assert( std::is_trivially_move_constructible_v<node_t>);
175static_assert( std::is_move_constructible_v<node_t>);
176static_assert( std::is_trivially_destructible_v<node_t>);
177static_assert( std::is_destructible_v<node_t>);
180static_assert( std::is_trivially_constructible_v<node_t, const node_t&>);
181static_assert( std::is_trivially_constructible_v<node_t, const node_t>);
182static_assert( std::is_trivially_constructible_v<node_t, node_t>);
183static_assert( std::is_trivially_constructible_v<node_t>);
184static_assert(not std::is_trivially_constructible_v<node_t, node>);
185static_assert(not std::is_trivially_constructible_v<node_t, uint64_t>);
186static_assert(not std::is_trivially_constructible_v<node_t, int64_t>);
187static_assert(not std::is_trivially_constructible_v<node_t, uint32_t>);
188static_assert(not std::is_trivially_constructible_v<node_t, int32_t>);
189static_assert(not std::is_trivially_constructible_v<node_t, uint16_t>);
190static_assert(not std::is_trivially_constructible_v<node_t, int16_t>);
191static_assert(not std::is_trivially_constructible_v<node_t, uint8_t>);
192static_assert(not std::is_trivially_constructible_v<node_t, int8_t>);
194static_assert( std::is_constructible_v<node_t, const node_t&>);
195static_assert( std::is_constructible_v<node_t, const node_t>);
196static_assert( std::is_constructible_v<node_t, node_t>);
197static_assert( std::is_constructible_v<node_t>);
198static_assert( std::is_constructible_v<node_t, node_t>);
199static_assert( std::is_constructible_v<node_t, node>);
200static_assert( std::is_constructible_v<node_t, uint64_t>);
201static_assert( std::is_constructible_v<node_t, int64_t>);
202static_assert( std::is_constructible_v<node_t, uint32_t>);
203static_assert( std::is_constructible_v<node_t, int32_t>);
204static_assert( std::is_constructible_v<node_t, uint16_t>);
205static_assert( std::is_constructible_v<node_t, int16_t>);
206static_assert( std::is_constructible_v<node_t, uint8_t>);
207static_assert( std::is_constructible_v<node_t, int8_t>);
210static_assert( std::is_trivially_assignable_v<node_t, const node_t&>);
211static_assert( std::is_trivially_assignable_v<node_t, const node_t>);
212static_assert( std::is_trivially_assignable_v<node_t, node_t>);
213static_assert(not std::is_trivially_assignable_v<node_t, node>);
214static_assert(not std::is_trivially_assignable_v<node_t, uint64_t>);
215static_assert(not std::is_trivially_assignable_v<node_t, int64_t>);
216static_assert(not std::is_trivially_assignable_v<node_t, uint32_t>);
217static_assert(not std::is_trivially_assignable_v<node_t, int32_t>);
218static_assert(not std::is_trivially_assignable_v<node_t, uint16_t>);
219static_assert(not std::is_trivially_assignable_v<node_t, int16_t>);
220static_assert(not std::is_trivially_assignable_v<node_t, uint8_t>);
221static_assert(not std::is_trivially_assignable_v<node_t, int8_t>);
223static_assert( std::is_assignable_v<node_t, const node_t&>);
224static_assert( std::is_assignable_v<node_t, const node_t>);
225static_assert( std::is_assignable_v<node_t, node_t>);
226static_assert( std::is_assignable_v<node_t, node_t>);
227static_assert( std::is_assignable_v<node_t, node>);
228static_assert( std::is_assignable_v<node_t, uint64_t>);
229static_assert( std::is_assignable_v<node_t, int64_t>);
230static_assert( std::is_assignable_v<node_t, uint32_t>);
231static_assert( std::is_assignable_v<node_t, int32_t>);
232static_assert( std::is_assignable_v<node_t, uint16_t>);
233static_assert( std::is_assignable_v<node_t, int16_t>);
234static_assert( std::is_assignable_v<node_t, uint8_t>);
235static_assert( std::is_assignable_v<node_t, int8_t>);
253 template <
typename T, __LAL_IS_INTEGRAL>
254 position_t(
const T& _v) noexcept : value(_v) { }
258 template <
typename T, __LAL_IS_INTEGRAL>
259 position_t& operator= (
const T& _v)
noexcept { value = _v;
return *
this; }
263 template <
typename T, __LAL_IS_INTEGRAL>
264 bool operator== (
const T& t)
const noexcept {
return value == t; }
265 bool operator== (
const position_t& u)
const noexcept {
return value == u.value; }
266 template <
typename T, __LAL_IS_INTEGRAL>
267 friend bool operator== (
const T& t,
const position_t& u)
noexcept {
return u.value == t; }
269 template <
typename T, __LAL_IS_INTEGRAL>
270 bool operator!= (
const T& t)
const noexcept {
return value != t; }
271 bool operator!= (
const position_t& u)
const noexcept {
return value != u.value; }
272 template <
typename T, __LAL_IS_INTEGRAL>
273 friend bool operator!= (
const T& t,
const position_t& u)
noexcept {
return u.value != t; }
275 template <
typename T, __LAL_IS_INTEGRAL>
276 bool operator< (
const T& t)
const noexcept {
return value < t; }
277 bool operator< (
const position_t& u)
const noexcept {
return value < u.value; }
278 template <
typename T, __LAL_IS_INTEGRAL>
279 friend bool operator< (
const T& t,
const position_t& u)
noexcept {
return t < u.value; }
281 template <
typename T, __LAL_IS_INTEGRAL>
282 bool operator<= (
const T& t)
const noexcept {
return value <= t; }
283 bool operator<= (
const position_t& u)
const noexcept {
return value <= u.value; }
284 template <
typename T, __LAL_IS_INTEGRAL>
285 friend bool operator<= (
const T& t,
const position_t& u)
noexcept {
return t <= u.value; }
287 template <
typename T, __LAL_IS_INTEGRAL>
288 bool operator> (
const T& t)
const noexcept {
return value > t; }
289 bool operator> (
const position_t& u)
const noexcept {
return value > u.value; }
290 template <
typename T, __LAL_IS_INTEGRAL>
291 friend bool operator> (
const T& t,
const position_t& u)
noexcept {
return t > u.value; }
293 template <
typename T, __LAL_IS_INTEGRAL>
294 bool operator>= (
const T& t)
const noexcept {
return value >= t; }
295 bool operator>= (
const position_t& u)
const noexcept {
return value >= u.value; }
296 template <
typename T, __LAL_IS_INTEGRAL>
297 friend bool operator>= (
const T& t,
const position_t& u)
noexcept {
return t >= u.value; }
301 template <
typename T, __LAL_IS_INTEGRAL>
304 template <
typename T, __LAL_IS_INTEGRAL>
307 template <
typename T, __LAL_IS_INTEGRAL>
308 position_t& operator+= (
const T& t)
noexcept { value += t;
return *
this; }
311 template <
typename T, __LAL_IS_INTEGRAL>
314 template <
typename T, __LAL_IS_INTEGRAL>
317 template <
typename T, __LAL_IS_INTEGRAL>
318 position_t& operator-= (
const T& t)
noexcept { value -= t;
return *
this; }
321 position_t& operator++()
noexcept { ++value;
return *
this; }
322 position_t& operator--()
noexcept { --value;
return *
this; }
326 template <
class stream>
327 friend stream& operator>> (stream& s,
position_t& p)
noexcept {
332 template <
class stream>
333 friend stream& operator<< (stream& s,
const position_t& p)
noexcept {
338 uint64_t operator*()
const noexcept {
return value; }
341static_assert( std::is_trivial_v<position_t>);
343static_assert( std::is_trivially_copyable_v<position_t>);
344static_assert( std::is_trivially_copy_assignable_v<position_t>);
345static_assert( std::is_copy_assignable_v<position_t>);
346static_assert( std::is_trivially_copy_constructible_v<position_t>);
347static_assert( std::is_copy_constructible_v<position_t>);
348static_assert( std::is_trivially_move_constructible_v<position_t>);
349static_assert( std::is_move_constructible_v<position_t>);
350static_assert( std::is_trivially_destructible_v<position_t>);
351static_assert( std::is_destructible_v<position_t>);
354static_assert( std::is_trivially_constructible_v<position_t, const position_t&>);
355static_assert( std::is_trivially_constructible_v<position_t, const position_t>);
356static_assert( std::is_trivially_constructible_v<position_t, position_t>);
357static_assert( std::is_trivially_constructible_v<position_t>);
358static_assert(not std::is_trivially_constructible_v<position_t, node>);
359static_assert(not std::is_trivially_constructible_v<position_t, uint64_t>);
360static_assert(not std::is_trivially_constructible_v<position_t, int64_t>);
361static_assert(not std::is_trivially_constructible_v<position_t, uint32_t>);
362static_assert(not std::is_trivially_constructible_v<position_t, int32_t>);
363static_assert(not std::is_trivially_constructible_v<position_t, uint16_t>);
364static_assert(not std::is_trivially_constructible_v<position_t, int16_t>);
365static_assert(not std::is_trivially_constructible_v<position_t, uint8_t>);
366static_assert(not std::is_trivially_constructible_v<position_t, int8_t>);
368static_assert( std::is_constructible_v<position_t, const position_t&>);
369static_assert( std::is_constructible_v<position_t, const position_t>);
370static_assert( std::is_constructible_v<position_t, position_t>);
371static_assert( std::is_constructible_v<position_t>);
372static_assert( std::is_constructible_v<position_t, position_t>);
373static_assert( std::is_constructible_v<position_t, node>);
374static_assert( std::is_constructible_v<position_t, uint64_t>);
375static_assert( std::is_constructible_v<position_t, int64_t>);
376static_assert( std::is_constructible_v<position_t, uint32_t>);
377static_assert( std::is_constructible_v<position_t, int32_t>);
378static_assert( std::is_constructible_v<position_t, uint16_t>);
379static_assert( std::is_constructible_v<position_t, int16_t>);
380static_assert( std::is_constructible_v<position_t, uint8_t>);
381static_assert( std::is_constructible_v<position_t, int8_t>);
384static_assert( std::is_trivially_assignable_v<position_t, const position_t&>);
385static_assert( std::is_trivially_assignable_v<position_t, const position_t>);
386static_assert( std::is_trivially_assignable_v<position_t, position_t>);
387static_assert(not std::is_trivially_assignable_v<position_t, node>);
388static_assert(not std::is_trivially_assignable_v<position_t, uint64_t>);
389static_assert(not std::is_trivially_assignable_v<position_t, int64_t>);
390static_assert(not std::is_trivially_assignable_v<position_t, uint32_t>);
391static_assert(not std::is_trivially_assignable_v<position_t, int32_t>);
392static_assert(not std::is_trivially_assignable_v<position_t, uint16_t>);
393static_assert(not std::is_trivially_assignable_v<position_t, int16_t>);
394static_assert(not std::is_trivially_assignable_v<position_t, uint8_t>);
395static_assert(not std::is_trivially_assignable_v<position_t, int8_t>);
397static_assert( std::is_assignable_v<position_t, const position_t&>);
398static_assert( std::is_assignable_v<position_t, const position_t>);
399static_assert( std::is_assignable_v<position_t, position_t>);
400static_assert( std::is_assignable_v<position_t, position_t>);
401static_assert( std::is_assignable_v<position_t, node>);
402static_assert( std::is_assignable_v<position_t, uint64_t>);
403static_assert( std::is_assignable_v<position_t, int64_t>);
404static_assert( std::is_assignable_v<position_t, uint32_t>);
405static_assert( std::is_assignable_v<position_t, int32_t>);
406static_assert( std::is_assignable_v<position_t, uint16_t>);
407static_assert( std::is_assignable_v<position_t, int16_t>);
408static_assert( std::is_assignable_v<position_t, uint8_t>);
409static_assert( std::is_assignable_v<position_t, int8_t>);
411#undef __LAL_IS_INTEGRAL