vcpkg/ports/mlpack/Fix-build-with-MSVC.patch
MonicaLiu 888191cd88
[mlpack] Update to 4.0.0 and become a header-only library (#27707)
* update mlpack

* update version

* update mlpack

* update version

* update mlpack

* update version

* update mlpack

* update version

* update format

* update version

* update license

* update version

* update mlpack

* update version

* update patch

* update version

* update patch

* update version

* update patch

* update version

Co-authored-by: Monica <v-liumonica@microsoft.com>
2022-11-21 09:04:06 -08:00

24 lines
847 B
Diff

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