vcpkg/ports/mlpack/Fix-build-with-MSVC.patch

24 lines
847 B
Diff
Raw Normal View History

diff --git a/src/mlpack/base.hpp b/src/mlpack/base.hpp
index 4879167814..151a59b589 100644
--- a/src/mlpack/base.hpp
+++ b/src/mlpack/base.hpp
@@ -69,12 +69,14 @@
// Backport std::any from C+17 to C++11 to replace boost::any.
// Use mnmlstc backport implementation only if compiler does not
// support C++17.
-#if __cplusplus < 201703L
+#if __cplusplus < 201703L && !defined(_MSC_VER)
#include <mlpack/core/std_backport/any.hpp>
#include <mlpack/core/std_backport/string_view.hpp>
#define MLPACK_ANY core::v2::any
#define MLPACK_ANY_CAST core::v2::any_cast
#define MLPACK_STRING_VIEW core::v2::string_view
+#elif __cplusplus < 201703L && defined(_MSC_VER)
+ #error "When using Visual Studio, mlpack should be compiled with /Zc:__cplusplus and /std:c++17 or newer."
#else
#include <any>
#include <string_view>
--
2.38.1