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 1c7be9a commit 95cccf8Copy full SHA for 95cccf8
src/util/system.h
@@ -25,6 +25,7 @@
25
#include <util/threadnames.h>
26
#include <util/time.h>
27
28
+#include <any>
29
#include <exception>
30
#include <map>
31
#include <optional>
@@ -500,6 +501,18 @@ inline void insert(std::set<TsetT>& dst, const Tsrc& src) {
500
501
dst.insert(src.begin(), src.end());
502
}
503
504
+/**
505
+ * Helper function to access the contained object of a std::any instance.
506
+ * Returns a pointer to the object if passed instance has a value and the type
507
+ * matches, nullptr otherwise.
508
+ */
509
+template<typename T>
510
+T* AnyPtr(const std::any& any) noexcept
511
+{
512
+ T* const* ptr = std::any_cast<T*>(&any);
513
+ return ptr ? *ptr : nullptr;
514
+}
515
+
516
#ifdef WIN32
517
class WinCmdLineArgs
518
{
0 commit comments