diff --git a/BGL/include/CGAL/boost/graph/internal/Has_member_clear.h b/BGL/include/CGAL/boost/graph/internal/Has_member_clear.h index dcf1c187a73..4ef31005de9 100644 --- a/BGL/include/CGAL/boost/graph/internal/Has_member_clear.h +++ b/BGL/include/CGAL/boost/graph/internal/Has_member_clear.h @@ -19,11 +19,8 @@ template class Has_member_clear { private: - template - class check {}; - - template - static char f(check*); + template + static auto f(int) -> decltype(std::declval().clear(), char()); template static int f(...); diff --git a/BGL/include/CGAL/boost/graph/internal/Has_member_id.h b/BGL/include/CGAL/boost/graph/internal/Has_member_id.h index a1c7822a21b..9660b8a18b5 100644 --- a/BGL/include/CGAL/boost/graph/internal/Has_member_id.h +++ b/BGL/include/CGAL/boost/graph/internal/Has_member_id.h @@ -18,25 +18,14 @@ namespace internal { template class Has_member_id { - typedef char yes[1]; - typedef char no[2]; - - struct BaseWithId - { - void id(){} - }; - struct Base : public Type, public BaseWithId {}; - - template - class Helper{}; + template + static auto check(int) -> decltype(std::declval().id(), char()); template - static no &check(U*, Helper* = 0); - - static yes &check(...); + static int check(...); public: - static const bool value = (sizeof(yes) == sizeof(check((Base*)(0)))); + static const bool value = (sizeof(char) == sizeof(check(0))); }; } // internal diff --git a/BGL/test/BGL/test_Has_member_clear.cpp b/BGL/test/BGL/test_Has_member_clear.cpp index cbc66de0864..5a78d9a2d7e 100644 --- a/BGL/test/BGL/test_Has_member_clear.cpp +++ b/BGL/test/BGL/test_Has_member_clear.cpp @@ -11,7 +11,7 @@ struct with_clear_but_args { void clear(int) {} }; -struct with_clear_but_const { +struct with_clear_const { void clear() const {} }; @@ -25,7 +25,7 @@ int main() CGAL_static_assertion(!Has_member_clear::value); - CGAL_static_assertion(!Has_member_clear::value); + CGAL_static_assertion(Has_member_clear::value); return 0; }