#include <list>
#include <map>
#include <memory>
-#include <optional>
#include <random>
#include <set>
#include <stdexcept>
#include <tuple>
#include <type_traits>
#include <unordered_map>
-#include <variant>
#include <boost/any.hpp>
#include <boost/format.hpp>
#include <boost/mpl/distance.hpp>
#include <boost/type_traits.hpp>
#include <lua.hpp>
+#if __cplusplus >= 201703L
+#include <variant>
+#include <optional>
+#endif /* C++17 */
+
// Set the older gcc define for tsan if clang or modern gcc tell us we have tsan.
#if defined(__has_feature)
#if __has_feature(thread_sanitizer)
// implementation of IsOptional
template<typename T>
struct LuaContext::IsOptional<boost::optional<T>> : public std::true_type {};
+#if __cplusplus >= 201703L
template<typename T>
struct LuaContext::IsOptional<std::optional<T>> : public std::true_type {};
+#endif /* C++ 17 */
// implementation of LuaFunctionCaller
template<typename TFunctionType>
};
};
+#if __cplusplus >= 201703L
// std::variant
template<typename... TTypes>
struct LuaContext::Pusher<std::variant<TTypes...>>
return obj;
}
};
+#endif /* C++17 */
// boost::optional
template<typename TType>
}
};
+#if __cplusplus >= 201703L
// std::optional
template<typename TType>
struct LuaContext::Pusher<std::optional<TType>> {
}
}
};
+#endif /* C++17 */
// tuple
template<typename... TTypes>
}
};
+#if __cplusplus >= 201703L
// NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks)
template<typename TType>
struct LuaContext::Reader<std::optional<TType>>
}
};
// NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks)
+#endif /* C++ 17 */
// boost::variant
template<typename... TTypes>
}
};
+#if __cplusplus >= 201703L
// std::variant
template<typename... TTypes>
struct LuaContext::Reader<std::variant<TTypes...>>
return variantRead(state, index);
}
};
+#endif /* C++ 17 */
// reading a tuple
// tuple have an additional argument for their functions, that is the maximum size to read