util: backport C++17 std::any and std::variant
The backported implementations are taken from Martin Moene's any-lite
(commit a2ee2e1cc4a3fcfe42ab44c46a65467b76b58f25) and variant-lite
(commit ff251b02253ff28db49bb20a79200514d8267d87).
The bundled copy of optional-lite is updated to commit
9a370efe62e084729a171a407b017aa58dc954c1.
Change-Id: I4afe117e357c82d51002f96b083aed0ec5eeda35
diff --git a/src/util/backports.hpp b/src/util/backports.hpp
index 70f62f3..bb0c462 100644
--- a/src/util/backports.hpp
+++ b/src/util/backports.hpp
@@ -49,7 +49,9 @@
#endif
#include "backports-ostream-joiner.hpp"
+#include "nonstd/any.hpp"
#include "nonstd/optional.hpp"
+#include "nonstd/variant.hpp"
#ifndef NDN_CXX_HAVE_STD_TO_STRING
#include <boost/lexical_cast.hpp>
@@ -86,6 +88,11 @@
}
#endif // __cpp_lib_clamp
+using ::nonstd::any;
+using ::nonstd::any_cast;
+using ::nonstd::bad_any_cast;
+using ::nonstd::make_any;
+
using ::nonstd::optional;
using ::nonstd::bad_optional_access;
using ::nonstd::nullopt;
@@ -94,6 +101,14 @@
using ::nonstd::in_place_t;
using ::nonstd::make_optional;
+using ::nonstd::variant;
+using ::nonstd::bad_variant_access;
+using ::nonstd::monostate;
+using ::nonstd::visit;
+using ::nonstd::holds_alternative;
+using ::nonstd::get_if;
+using ::nonstd::variant_npos;
+
} // namespace ndn
#endif // NDN_UTIL_BACKPORTS_HPP