We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d8ea9e6 commit 3e62caeCopy full SHA for 3e62cae
AK/Variant.h
@@ -355,6 +355,14 @@ struct Variant
355
return nullptr;
356
}
357
358
+ template<typename T>
359
+ T& unsafe_get()
360
+ requires(can_contain<T>())
361
+ {
362
+ ASSERT(has<T>());
363
+ return *bit_cast<T*>(&m_data);
364
+ }
365
+
366
template<typename T>
367
T& get()
368
requires(can_contain<T>())
@@ -380,6 +388,14 @@ struct Variant
380
388
return *bit_cast<T const*>(&m_data);
381
389
382
390
391
392
+ T const& unsafe_get() const
393
394
395
396
+ return *bit_cast<T const*>(&m_data);
397
398
383
399
384
400
[[nodiscard]] bool has() const
385
401
0 commit comments