From 5db243629a35d535b6bec49990680fd813957a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 14 Aug 2023 14:02:39 +0200 Subject: [PATCH] try working around an error with MSVC2017 `error C2338: Sorry: std::any doesn't support over-aligned types at this time.` --- STL_Extension/include/CGAL/Object.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/STL_Extension/include/CGAL/Object.h b/STL_Extension/include/CGAL/Object.h index 8a3ed24dad5..765b5e70e3f 100644 --- a/STL_Extension/include/CGAL/Object.h +++ b/STL_Extension/include/CGAL/Object.h @@ -29,20 +29,20 @@ #include #include -#include +#include #include namespace CGAL { class Object { - std::shared_ptr obj; + std::shared_ptr obj; // returns an any pointer from a variant struct Any_from_variant { template - std::any* operator()(const T& t) const { - return new std::any(t); + boost::any* operator()(const T& t) const { + return new boost::any(t); } }; @@ -59,7 +59,7 @@ class Object Object() : obj() { } template - Object(T && t, private_tag) : obj(new std::any(std::forward(t))) { } + Object(T && t, private_tag) : obj(new boost::any(std::forward(t))) { } // implicit constructor from optionals containing variants template @@ -74,7 +74,7 @@ class Object template bool assign(T &t) const { - const T* res = std::any_cast(obj.get()); + const T* res = boost::any_cast(obj.get()); if (!res) return false; t = *res; return true; @@ -103,7 +103,7 @@ class Object template bool is() const { - return obj && std::any_cast(obj.get()); + return obj && boost::any_cast(obj.get()); } const std::type_info & type() const @@ -157,14 +157,14 @@ template inline const T * object_cast(const Object * o) { - return std::any_cast((o->obj).get()); + return boost::any_cast((o->obj).get()); } template inline T object_cast(const Object & o) { - const T * result = std::any_cast((o.obj).get()); + const T * result = boost::any_cast((o.obj).get()); if (!result) throw Bad_object_cast(); return *result;