File: impl_toml.cpp

package info (click to toggle)
tomlplusplus 3.3.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,184 kB
  • sloc: cpp: 35,145; ansic: 2,220; python: 983; makefile: 25; sh: 17
file content (407 lines) | stat: -rw-r--r-- 24,304 bytes parent folder | download
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
// This file is a part of toml++ and is subject to the the terms of the MIT license.
// Copyright (c) Mark Gillard <mark.gillard@outlook.com.au>
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT

#include "settings.h"
#if !TOML_HEADER_ONLY && !TOML_SHARED_LIB
#define TOML_IMPLEMENTATION
#endif

#if USE_SINGLE_HEADER
#include "../toml.hpp"
#else
#include "../include/toml++/toml.h"
#endif

namespace toml
{
	using std::declval;
	using std::is_same_v;

#define CHECK_NODE_TYPE_MAPPING(T, expected)                                                                           \
	static_assert(impl::node_type_of<T> == expected);                                                                  \
	static_assert(impl::node_type_of<T&> == expected);                                                                 \
	static_assert(impl::node_type_of<T&&> == expected);                                                                \
	static_assert(impl::node_type_of<const T> == expected);                                                            \
	static_assert(impl::node_type_of<const T&> == expected);                                                           \
	static_assert(impl::node_type_of<const T&&> == expected);                                                          \
	static_assert(impl::node_type_of<volatile T> == expected);                                                         \
	static_assert(impl::node_type_of<volatile T&> == expected);                                                        \
	static_assert(impl::node_type_of<volatile T&&> == expected);                                                       \
	static_assert(impl::node_type_of<const volatile T> == expected);                                                   \
	static_assert(impl::node_type_of<const volatile T&> == expected);                                                  \
	static_assert(impl::node_type_of<const volatile T&&> == expected)

	CHECK_NODE_TYPE_MAPPING(int64_t, node_type::integer);
	CHECK_NODE_TYPE_MAPPING(double, node_type::floating_point);
	CHECK_NODE_TYPE_MAPPING(std::string, node_type::string);
	CHECK_NODE_TYPE_MAPPING(bool, node_type::boolean);
	CHECK_NODE_TYPE_MAPPING(toml::date, node_type::date);
	CHECK_NODE_TYPE_MAPPING(toml::time, node_type::time);
	CHECK_NODE_TYPE_MAPPING(toml::date_time, node_type::date_time);
	CHECK_NODE_TYPE_MAPPING(toml::array, node_type::array);
	CHECK_NODE_TYPE_MAPPING(toml::table, node_type::table);

#define CHECK_CAN_REPRESENT_NATIVE(T, expected)                                                                        \
	static_assert((impl::value_traits<T>::is_native || impl::value_traits<T>::can_represent_native) == expected)

	CHECK_CAN_REPRESENT_NATIVE(time, true);
	CHECK_CAN_REPRESENT_NATIVE(date, true);
	CHECK_CAN_REPRESENT_NATIVE(date_time, true);
	CHECK_CAN_REPRESENT_NATIVE(bool, true);
	CHECK_CAN_REPRESENT_NATIVE(int8_t, false);
	CHECK_CAN_REPRESENT_NATIVE(int16_t, false);
	CHECK_CAN_REPRESENT_NATIVE(int32_t, false);
	CHECK_CAN_REPRESENT_NATIVE(int64_t, true);
	CHECK_CAN_REPRESENT_NATIVE(uint8_t, false);
	CHECK_CAN_REPRESENT_NATIVE(uint16_t, false);
	CHECK_CAN_REPRESENT_NATIVE(uint32_t, false);
	CHECK_CAN_REPRESENT_NATIVE(uint64_t, false);
	CHECK_CAN_REPRESENT_NATIVE(float, false);
	CHECK_CAN_REPRESENT_NATIVE(double, true);
#ifdef TOML_INT128
	CHECK_CAN_REPRESENT_NATIVE(TOML_INT128, true);
	CHECK_CAN_REPRESENT_NATIVE(TOML_UINT128, false);
#endif
#if TOML_ENABLE_FLOAT16
	CHECK_CAN_REPRESENT_NATIVE(_Float16, false);
#endif
#ifdef TOML_FLOAT128
	CHECK_CAN_REPRESENT_NATIVE(TOML_FLOAT128, true);
#endif

	CHECK_CAN_REPRESENT_NATIVE(char*, false);
	CHECK_CAN_REPRESENT_NATIVE(char* const, false);
	CHECK_CAN_REPRESENT_NATIVE(char[2], false);
	CHECK_CAN_REPRESENT_NATIVE(const char[2], false);
	CHECK_CAN_REPRESENT_NATIVE(char (&)[2], false);
	CHECK_CAN_REPRESENT_NATIVE(const char (&)[2], false);
	CHECK_CAN_REPRESENT_NATIVE(char (&&)[2], false);
	CHECK_CAN_REPRESENT_NATIVE(const char (&&)[2], false);
	CHECK_CAN_REPRESENT_NATIVE(const char*, true);
	CHECK_CAN_REPRESENT_NATIVE(const char* const, true);
	CHECK_CAN_REPRESENT_NATIVE(std::string, true);
	CHECK_CAN_REPRESENT_NATIVE(std::string_view, true);
#if TOML_HAS_CHAR8
	CHECK_CAN_REPRESENT_NATIVE(char8_t*, false);
	CHECK_CAN_REPRESENT_NATIVE(char8_t* const, false);
	CHECK_CAN_REPRESENT_NATIVE(char8_t[2], false);
	CHECK_CAN_REPRESENT_NATIVE(const char8_t[2], false);
	CHECK_CAN_REPRESENT_NATIVE(char8_t (&)[2], false);
	CHECK_CAN_REPRESENT_NATIVE(const char8_t (&)[2], false);
	CHECK_CAN_REPRESENT_NATIVE(char (&&)[2], false);
	CHECK_CAN_REPRESENT_NATIVE(const char8_t (&&)[2], false);
	CHECK_CAN_REPRESENT_NATIVE(const char8_t*, true);
	CHECK_CAN_REPRESENT_NATIVE(const char8_t* const, true);
	CHECK_CAN_REPRESENT_NATIVE(std::u8string, true);
	CHECK_CAN_REPRESENT_NATIVE(std::u8string_view, true);
#endif
	CHECK_CAN_REPRESENT_NATIVE(wchar_t*, false);
	CHECK_CAN_REPRESENT_NATIVE(wchar_t* const, false);
	CHECK_CAN_REPRESENT_NATIVE(wchar_t[2], false);
	CHECK_CAN_REPRESENT_NATIVE(const wchar_t[2], false);
	CHECK_CAN_REPRESENT_NATIVE(wchar_t (&)[2], false);
	CHECK_CAN_REPRESENT_NATIVE(const wchar_t (&)[2], false);
	CHECK_CAN_REPRESENT_NATIVE(wchar_t (&&)[2], false);
	CHECK_CAN_REPRESENT_NATIVE(const wchar_t (&&)[2], false);
	CHECK_CAN_REPRESENT_NATIVE(const wchar_t*, false);
	CHECK_CAN_REPRESENT_NATIVE(const wchar_t* const, false);
	CHECK_CAN_REPRESENT_NATIVE(std::wstring, !!TOML_ENABLE_WINDOWS_COMPAT);
	CHECK_CAN_REPRESENT_NATIVE(std::wstring_view, false);

#define CHECK_VALUE_EXACT(T, expected)                                                                                 \
	static_assert(is_same_v<decltype(declval<node>().value_exact<T>()), optional<expected>>);                          \
	static_assert(is_same_v<decltype(declval<node_view<node>>().value_exact<T>()), optional<expected>>);               \
	static_assert(is_same_v<decltype(declval<node_view<const node>>().value_exact<T>()), optional<expected>>)

#define CHECK_VALUE_OR(T, expected)                                                                                    \
	static_assert(is_same_v<decltype(declval<node>().value_or(declval<T>())), expected>);                              \
	static_assert(is_same_v<decltype(declval<node_view<node>>().value_or(declval<T>())), expected>);                   \
	static_assert(is_same_v<decltype(declval<node_view<const node>>().value_or(declval<T>())), expected>)

	CHECK_VALUE_EXACT(time, time);
	CHECK_VALUE_EXACT(date, date);
	CHECK_VALUE_EXACT(date_time, date_time);
	CHECK_VALUE_EXACT(bool, bool);
	CHECK_VALUE_EXACT(double, double);
	CHECK_VALUE_EXACT(int64_t, int64_t);
	CHECK_VALUE_EXACT(const char*, const char*);
	CHECK_VALUE_EXACT(std::string_view, std::string_view);
	CHECK_VALUE_EXACT(std::string, std::string);
#if TOML_HAS_CHAR8
	CHECK_VALUE_EXACT(const char8_t*, const char8_t*);
	CHECK_VALUE_EXACT(std::u8string_view, std::u8string_view);
	CHECK_VALUE_EXACT(std::u8string, std::u8string);
#endif

	CHECK_VALUE_OR(time, time);
	CHECK_VALUE_OR(time&, time);
	CHECK_VALUE_OR(time&&, time);
	CHECK_VALUE_OR(time const, time);
	CHECK_VALUE_OR(date, date);
	CHECK_VALUE_OR(date&, date);
	CHECK_VALUE_OR(date&&, date);
	CHECK_VALUE_OR(date const, date);
	CHECK_VALUE_OR(date_time, date_time);
	CHECK_VALUE_OR(date_time&, date_time);
	CHECK_VALUE_OR(date_time&&, date_time);
	CHECK_VALUE_OR(date_time const, date_time);
	CHECK_VALUE_OR(bool, bool);
	CHECK_VALUE_OR(bool&, bool);
	CHECK_VALUE_OR(bool&&, bool);
	CHECK_VALUE_OR(bool const, bool);
	CHECK_VALUE_OR(int32_t, int32_t);
	CHECK_VALUE_OR(int32_t&, int32_t);
	CHECK_VALUE_OR(int32_t&&, int32_t);
	CHECK_VALUE_OR(int32_t const, int32_t);
	CHECK_VALUE_OR(int64_t, int64_t);
	CHECK_VALUE_OR(int64_t&, int64_t);
	CHECK_VALUE_OR(int64_t&&, int64_t);
	CHECK_VALUE_OR(int64_t const, int64_t);
#ifdef TOML_INT128
	CHECK_VALUE_OR(TOML_INT128, TOML_INT128);
	CHECK_VALUE_OR(TOML_INT128&, TOML_INT128);
	CHECK_VALUE_OR(TOML_INT128&&, TOML_INT128);
	CHECK_VALUE_OR(TOML_INT128 const, TOML_INT128);
	CHECK_VALUE_OR(TOML_UINT128, TOML_UINT128);
	CHECK_VALUE_OR(TOML_UINT128&, TOML_UINT128);
	CHECK_VALUE_OR(TOML_UINT128&&, TOML_UINT128);
	CHECK_VALUE_OR(TOML_UINT128 const, TOML_UINT128);
#endif
	CHECK_VALUE_OR(float, float);
	CHECK_VALUE_OR(float&, float);
	CHECK_VALUE_OR(float&&, float);
	CHECK_VALUE_OR(float const, float);
	CHECK_VALUE_OR(double, double);
	CHECK_VALUE_OR(double&, double);
	CHECK_VALUE_OR(double&&, double);
	CHECK_VALUE_OR(double const, double);
#ifdef TOML_FLOAT128
	CHECK_VALUE_OR(TOML_FLOAT128, TOML_FLOAT128);
	CHECK_VALUE_OR(TOML_FLOAT128&, TOML_FLOAT128);
	CHECK_VALUE_OR(TOML_FLOAT128&&, TOML_FLOAT128);
	CHECK_VALUE_OR(TOML_FLOAT128 const, TOML_FLOAT128);
#endif
	CHECK_VALUE_OR(char*, const char*);
	CHECK_VALUE_OR(char*&, const char*);
	CHECK_VALUE_OR(char*&&, const char*);
	CHECK_VALUE_OR(char* const, const char*);
	CHECK_VALUE_OR(char[2], const char*);
	CHECK_VALUE_OR(char (&)[2], const char*);
	CHECK_VALUE_OR(char (&&)[2], const char*);
	CHECK_VALUE_OR(const char*, const char*);
	CHECK_VALUE_OR(const char*&, const char*);
	CHECK_VALUE_OR(const char*&&, const char*);
	CHECK_VALUE_OR(const char* const, const char*);
	CHECK_VALUE_OR(const char[2], const char*);
	CHECK_VALUE_OR(const char (&)[2], const char*);
	CHECK_VALUE_OR(const char (&&)[2], const char*);
	CHECK_VALUE_OR(std::string_view, std::string_view);
	CHECK_VALUE_OR(std::string_view&, std::string_view);
	CHECK_VALUE_OR(std::string_view&&, std::string_view);
	CHECK_VALUE_OR(const std::string_view, std::string_view);
	CHECK_VALUE_OR(const std::string_view&, std::string_view);
	CHECK_VALUE_OR(const std::string_view&&, std::string_view);
	CHECK_VALUE_OR(std::string, std::string);
	CHECK_VALUE_OR(std::string&, std::string);
	CHECK_VALUE_OR(std::string&&, std::string);
	CHECK_VALUE_OR(const std::string, std::string);
	CHECK_VALUE_OR(const std::string&, std::string);
	CHECK_VALUE_OR(const std::string&&, std::string);
#if TOML_HAS_CHAR8
	CHECK_VALUE_OR(char8_t*, const char8_t*);
	CHECK_VALUE_OR(char8_t*&, const char8_t*);
	CHECK_VALUE_OR(char8_t*&&, const char8_t*);
	CHECK_VALUE_OR(char8_t* const, const char8_t*);
	CHECK_VALUE_OR(char8_t[2], const char8_t*);
	CHECK_VALUE_OR(char8_t (&)[2], const char8_t*);
	CHECK_VALUE_OR(char8_t (&&)[2], const char8_t*);
	CHECK_VALUE_OR(const char8_t*, const char8_t*);
	CHECK_VALUE_OR(const char8_t*&, const char8_t*);
	CHECK_VALUE_OR(const char8_t*&&, const char8_t*);
	CHECK_VALUE_OR(const char8_t* const, const char8_t*);
	CHECK_VALUE_OR(const char8_t[2], const char8_t*);
	CHECK_VALUE_OR(const char8_t (&)[2], const char8_t*);
	CHECK_VALUE_OR(const char8_t (&&)[2], const char8_t*);
	CHECK_VALUE_OR(std::u8string_view, std::u8string_view);
	CHECK_VALUE_OR(std::u8string_view&, std::u8string_view);
	CHECK_VALUE_OR(std::u8string_view&&, std::u8string_view);
	CHECK_VALUE_OR(const std::u8string_view, std::u8string_view);
	CHECK_VALUE_OR(const std::u8string_view&, std::u8string_view);
	CHECK_VALUE_OR(const std::u8string_view&&, std::u8string_view);
	CHECK_VALUE_OR(std::u8string, std::u8string);
	CHECK_VALUE_OR(std::u8string&, std::u8string);
	CHECK_VALUE_OR(std::u8string&&, std::u8string);
	CHECK_VALUE_OR(const std::u8string, std::u8string);
	CHECK_VALUE_OR(const std::u8string&, std::u8string);
	CHECK_VALUE_OR(const std::u8string&&, std::u8string);
#endif
#if TOML_ENABLE_WINDOWS_COMPAT
	CHECK_VALUE_OR(wchar_t*, std::wstring);
	CHECK_VALUE_OR(wchar_t*&, std::wstring);
	CHECK_VALUE_OR(wchar_t*&&, std::wstring);
	CHECK_VALUE_OR(wchar_t* const, std::wstring);
	CHECK_VALUE_OR(wchar_t[2], std::wstring);
	CHECK_VALUE_OR(wchar_t (&)[2], std::wstring);
	CHECK_VALUE_OR(wchar_t (&&)[2], std::wstring);
	CHECK_VALUE_OR(const wchar_t*, std::wstring);
	CHECK_VALUE_OR(const wchar_t*&, std::wstring);
	CHECK_VALUE_OR(const wchar_t*&&, std::wstring);
	CHECK_VALUE_OR(const wchar_t* const, std::wstring);
	CHECK_VALUE_OR(const wchar_t[2], std::wstring);
	CHECK_VALUE_OR(const wchar_t (&)[2], std::wstring);
	CHECK_VALUE_OR(const wchar_t (&&)[2], std::wstring);
	CHECK_VALUE_OR(std::wstring_view, std::wstring);
	CHECK_VALUE_OR(std::wstring_view&, std::wstring);
	CHECK_VALUE_OR(std::wstring_view&&, std::wstring);
	CHECK_VALUE_OR(const std::wstring_view, std::wstring);
	CHECK_VALUE_OR(const std::wstring_view&, std::wstring);
	CHECK_VALUE_OR(const std::wstring_view&&, std::wstring);
	CHECK_VALUE_OR(std::wstring, std::wstring);
	CHECK_VALUE_OR(std::wstring&, std::wstring);
	CHECK_VALUE_OR(std::wstring&&, std::wstring);
	CHECK_VALUE_OR(const std::wstring, std::wstring);
	CHECK_VALUE_OR(const std::wstring&, std::wstring);
	CHECK_VALUE_OR(const std::wstring&&, std::wstring);
#endif

#define CHECK_INSERTED_AS(T, expected)                                                                                 \
	static_assert(std::is_same_v<toml::inserted_type_of<T>, expected>);                                                \
	static_assert(std::is_same_v<toml::inserted_type_of<const T>, expected>);                                          \
	static_assert(std::is_same_v<toml::inserted_type_of<T&>, expected>);                                               \
	static_assert(std::is_same_v<toml::inserted_type_of<const T&>, expected>);                                         \
	static_assert(std::is_same_v<toml::inserted_type_of<T&&>, expected>)

	CHECK_INSERTED_AS(table, table);
	CHECK_INSERTED_AS(array, array);
	CHECK_INSERTED_AS(node, node);
	CHECK_INSERTED_AS(time, value<time>);
	CHECK_INSERTED_AS(date, value<date>);
	CHECK_INSERTED_AS(date_time, value<date_time>);
	CHECK_INSERTED_AS(bool, value<bool>);
	CHECK_INSERTED_AS(int8_t, value<int64_t>);
	CHECK_INSERTED_AS(int16_t, value<int64_t>);
	CHECK_INSERTED_AS(int32_t, value<int64_t>);
	CHECK_INSERTED_AS(int64_t, value<int64_t>);
	CHECK_INSERTED_AS(uint8_t, value<int64_t>);
	CHECK_INSERTED_AS(uint16_t, value<int64_t>);
	CHECK_INSERTED_AS(uint32_t, value<int64_t>);
	CHECK_INSERTED_AS(float, value<double>);
	CHECK_INSERTED_AS(double, value<double>);
#if TOML_ENABLE_FLOAT16
	CHECK_INSERTED_AS(_Float16, value<double>);
#endif

#define CHECK_NODE_REF_TYPE(T)                                                                                         \
	static_assert(is_same_v<decltype(declval<node&>().ref<T>()), T&>);                                                 \
	static_assert(is_same_v<decltype(declval<node&>().ref<const T>()), const T&>);                                     \
	static_assert(is_same_v<decltype(declval<node&>().ref<volatile T>()), volatile T&>);                               \
	static_assert(is_same_v<decltype(declval<node&>().ref<const volatile T>()), const volatile T&>);                   \
	static_assert(is_same_v<decltype(declval<node&>().ref<T&>()), T&>);                                                \
	static_assert(is_same_v<decltype(declval<node&>().ref<const T&>()), const T&>);                                    \
	static_assert(is_same_v<decltype(declval<node&>().ref<volatile T&>()), volatile T&>);                              \
	static_assert(is_same_v<decltype(declval<node&>().ref<const volatile T&>()), const volatile T&>);                  \
	static_assert(is_same_v<decltype(declval<node&>().ref<T&&>()), T&&>);                                              \
	static_assert(is_same_v<decltype(declval<node&>().ref<const T&&>()), const T&&>);                                  \
	static_assert(is_same_v<decltype(declval<node&>().ref<volatile T&&>()), volatile T&&>);                            \
	static_assert(is_same_v<decltype(declval<node&>().ref<const volatile T&&>()), const volatile T&&>);                \
                                                                                                                       \
	static_assert(is_same_v<decltype(declval<node&&>().ref<T>()), T&&>);                                               \
	static_assert(is_same_v<decltype(declval<node&&>().ref<const T>()), const T&&>);                                   \
	static_assert(is_same_v<decltype(declval<node&&>().ref<volatile T>()), volatile T&&>);                             \
	static_assert(is_same_v<decltype(declval<node&&>().ref<const volatile T>()), const volatile T&&>);                 \
	static_assert(is_same_v<decltype(declval<node&&>().ref<T&>()), T&>);                                               \
	static_assert(is_same_v<decltype(declval<node&&>().ref<const T&>()), const T&>);                                   \
	static_assert(is_same_v<decltype(declval<node&&>().ref<volatile T&>()), volatile T&>);                             \
	static_assert(is_same_v<decltype(declval<node&&>().ref<const volatile T&>()), const volatile T&>);                 \
	static_assert(is_same_v<decltype(declval<node&&>().ref<T&&>()), T&&>);                                             \
	static_assert(is_same_v<decltype(declval<node&&>().ref<const T&&>()), const T&&>);                                 \
	static_assert(is_same_v<decltype(declval<node&&>().ref<volatile T&&>()), volatile T&&>);                           \
	static_assert(is_same_v<decltype(declval<node&&>().ref<const volatile T&&>()), const volatile T&&>);               \
                                                                                                                       \
	static_assert(is_same_v<decltype(declval<const node&>().ref<T>()), const T&>);                                     \
	static_assert(is_same_v<decltype(declval<const node&>().ref<const T>()), const T&>);                               \
	static_assert(is_same_v<decltype(declval<const node&>().ref<volatile T>()), const volatile T&>);                   \
	static_assert(is_same_v<decltype(declval<const node&>().ref<const volatile T>()), const volatile T&>);             \
	static_assert(is_same_v<decltype(declval<const node&>().ref<T&>()), const T&>);                                    \
	static_assert(is_same_v<decltype(declval<const node&>().ref<const T&>()), const T&>);                              \
	static_assert(is_same_v<decltype(declval<const node&>().ref<volatile T&>()), const volatile T&>);                  \
	static_assert(is_same_v<decltype(declval<const node&>().ref<const volatile T&>()), const volatile T&>);            \
	static_assert(is_same_v<decltype(declval<const node&>().ref<T&&>()), const T&&>);                                  \
	static_assert(is_same_v<decltype(declval<const node&>().ref<const T&&>()), const T&&>);                            \
	static_assert(is_same_v<decltype(declval<const node&>().ref<volatile T&&>()), const volatile T&&>);                \
	static_assert(is_same_v<decltype(declval<const node&>().ref<const volatile T&&>()), const volatile T&&>);          \
                                                                                                                       \
	static_assert(is_same_v<decltype(declval<const node&&>().ref<T>()), const T&&>);                                   \
	static_assert(is_same_v<decltype(declval<const node&&>().ref<const T>()), const T&&>);                             \
	static_assert(is_same_v<decltype(declval<const node&&>().ref<volatile T>()), const volatile T&&>);                 \
	static_assert(is_same_v<decltype(declval<const node&&>().ref<const volatile T>()), const volatile T&&>);           \
	static_assert(is_same_v<decltype(declval<const node&&>().ref<T&>()), const T&>);                                   \
	static_assert(is_same_v<decltype(declval<const node&&>().ref<const T&>()), const T&>);                             \
	static_assert(is_same_v<decltype(declval<const node&&>().ref<volatile T&>()), const volatile T&>);                 \
	static_assert(is_same_v<decltype(declval<const node&&>().ref<const volatile T&>()), const volatile T&>);           \
	static_assert(is_same_v<decltype(declval<const node&&>().ref<T&&>()), const T&&>);                                 \
	static_assert(is_same_v<decltype(declval<const node&&>().ref<const T&&>()), const T&&>);                           \
	static_assert(is_same_v<decltype(declval<const node&&>().ref<volatile T&&>()), const volatile T&&>);               \
	static_assert(is_same_v<decltype(declval<const node&&>().ref<const volatile T&&>()), const volatile T&&>)

	CHECK_NODE_REF_TYPE(table);
	CHECK_NODE_REF_TYPE(array);
	CHECK_NODE_REF_TYPE(std::string);
	CHECK_NODE_REF_TYPE(int64_t);
	CHECK_NODE_REF_TYPE(double);
	CHECK_NODE_REF_TYPE(bool);
	CHECK_NODE_REF_TYPE(date);
	CHECK_NODE_REF_TYPE(time);
	CHECK_NODE_REF_TYPE(date_time);

#define CHECK_NODE_VIEW_REF_TYPE(T)                                                                                    \
	static_assert(is_same_v<decltype(declval<node_view<node>>().ref<T>()), T&>);                                       \
	static_assert(is_same_v<decltype(declval<node_view<node>>().ref<const T>()), const T&>);                           \
	static_assert(is_same_v<decltype(declval<node_view<node>>().ref<volatile T>()), volatile T&>);                     \
	static_assert(is_same_v<decltype(declval<node_view<node>>().ref<const volatile T>()), const volatile T&>);         \
	static_assert(is_same_v<decltype(declval<node_view<node>>().ref<T&>()), T&>);                                      \
	static_assert(is_same_v<decltype(declval<node_view<node>>().ref<const T&>()), const T&>);                          \
	static_assert(is_same_v<decltype(declval<node_view<node>>().ref<volatile T&>()), volatile T&>);                    \
	static_assert(is_same_v<decltype(declval<node_view<node>>().ref<const volatile T&>()), const volatile T&>);        \
	static_assert(is_same_v<decltype(declval<node_view<node>>().ref<T&&>()), T&&>);                                    \
	static_assert(is_same_v<decltype(declval<node_view<node>>().ref<const T&&>()), const T&&>);                        \
	static_assert(is_same_v<decltype(declval<node_view<node>>().ref<volatile T&&>()), volatile T&&>);                  \
	static_assert(is_same_v<decltype(declval<node_view<node>>().ref<const volatile T&&>()), const volatile T&&>)

	CHECK_NODE_VIEW_REF_TYPE(table);
	CHECK_NODE_VIEW_REF_TYPE(array);
	CHECK_NODE_VIEW_REF_TYPE(std::string);
	CHECK_NODE_VIEW_REF_TYPE(int64_t);
	CHECK_NODE_VIEW_REF_TYPE(double);
	CHECK_NODE_VIEW_REF_TYPE(bool);
	CHECK_NODE_VIEW_REF_TYPE(date);
	CHECK_NODE_VIEW_REF_TYPE(time);
	CHECK_NODE_VIEW_REF_TYPE(date_time);

#define CHECK_CONST_NODE_VIEW_REF_TYPE(T)                                                                              \
	static_assert(is_same_v<decltype(declval<node_view<const node>>().ref<T>()), const T&>);                           \
	static_assert(is_same_v<decltype(declval<node_view<const node>>().ref<const T>()), const T&>);                     \
	static_assert(is_same_v<decltype(declval<node_view<const node>>().ref<volatile T>()), const volatile T&>);         \
	static_assert(is_same_v<decltype(declval<node_view<const node>>().ref<const volatile T>()), const volatile T&>);   \
	static_assert(is_same_v<decltype(declval<node_view<const node>>().ref<T&>()), const T&>);                          \
	static_assert(is_same_v<decltype(declval<node_view<const node>>().ref<const T&>()), const T&>);                    \
	static_assert(is_same_v<decltype(declval<node_view<const node>>().ref<volatile T&>()), const volatile T&>);        \
	static_assert(is_same_v<decltype(declval<node_view<const node>>().ref<const volatile T&>()), const volatile T&>);  \
	static_assert(is_same_v<decltype(declval<node_view<const node>>().ref<T&&>()), const T&&>);                        \
	static_assert(is_same_v<decltype(declval<node_view<const node>>().ref<const T&&>()), const T&&>);                  \
	static_assert(is_same_v<decltype(declval<node_view<const node>>().ref<volatile T&&>()), const volatile T&&>);      \
	static_assert(is_same_v<decltype(declval<node_view<const node>>().ref<const volatile T&&>()), const volatile T&&>)

	CHECK_CONST_NODE_VIEW_REF_TYPE(table);
	CHECK_CONST_NODE_VIEW_REF_TYPE(array);
	CHECK_CONST_NODE_VIEW_REF_TYPE(std::string);
	CHECK_CONST_NODE_VIEW_REF_TYPE(int64_t);
	CHECK_CONST_NODE_VIEW_REF_TYPE(double);
	CHECK_CONST_NODE_VIEW_REF_TYPE(bool);
	CHECK_CONST_NODE_VIEW_REF_TYPE(date);
	CHECK_CONST_NODE_VIEW_REF_TYPE(time);
	CHECK_CONST_NODE_VIEW_REF_TYPE(date_time);

}