From 303b0ab46e219aaf6545ce25a921b455127b8a8a Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 16 Apr 2018 11:00:03 +0100 Subject: [PATCH] Fix detection of CGAL_CXX11 for VC++ and fixes of usage of std::allocator_traits --- Installation/include/CGAL/config.h | 2 +- STL_Extension/include/CGAL/Compact_container.h | 11 +++++------ .../include/CGAL/Concurrent_compact_container.h | 7 +++---- STL_Extension/include/CGAL/In_place_list.h | 8 ++++---- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index 441188bc3f3..e4d5b36d73d 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -259,7 +259,7 @@ // Some random list to let us write C++11 without thinking about // each feature we are using. -#if __cplusplus >= 201103L && \ +#if ( __cplusplus >= 201103L || _MSVC_LANG >= 201103L ) && \ !defined CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES && \ !defined CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE && \ !defined CGAL_CFG_NO_CPP0X_EXPLICIT_CONVERSION_OPERATORS && \ diff --git a/STL_Extension/include/CGAL/Compact_container.h b/STL_Extension/include/CGAL/Compact_container.h index 63f0369bbba..e749455c606 100644 --- a/STL_Extension/include/CGAL/Compact_container.h +++ b/STL_Extension/include/CGAL/Compact_container.h @@ -253,24 +253,23 @@ public: typedef T value_type; typedef Allocator allocator_type; + typedef value_type& reference; + typedef const value_type& const_reference; + #ifdef CGAL_CXX11 - typedef typename std::allocator_traits::reference reference; - typedef typename std::allocator_traits::const_reference const_reference; typedef typename std::allocator_traits::pointer pointer; typedef typename std::allocator_traits::const_pointer const_pointer; typedef typename std::allocator_traits::size_type size_type; typedef typename std::allocator_traits::difference_type difference_type; #else - typedef typename Allocator::reference reference; - typedef typename Allocator::const_reference const_reference; typedef typename Allocator::pointer pointer; typedef typename Allocator::const_pointer const_pointer; typedef typename Allocator::size_type size_type; typedef typename Allocator::difference_type difference_type; #endif - typedef internal::CC_iterator iterator; - typedef internal::CC_iterator const_iterator; + typedef internal::CC_iterator iterator; + typedef internal::CC_iterator const_iterator; typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; diff --git a/STL_Extension/include/CGAL/Concurrent_compact_container.h b/STL_Extension/include/CGAL/Concurrent_compact_container.h index 4089ccb2bd2..35448724587 100644 --- a/STL_Extension/include/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/include/CGAL/Concurrent_compact_container.h @@ -177,16 +177,15 @@ public: typedef T value_type; typedef Allocator allocator_type; + typedef value_type& reference; + typedef const value_type& const_reference; + #ifdef CGAL_CXX11 - typedef typename std::allocator_traits::reference reference; - typedef typename std::allocator_traits::const_reference const_reference; typedef typename std::allocator_traits::pointer pointer; typedef typename std::allocator_traits::const_pointer const_pointer; typedef typename std::allocator_traits::size_type size_type; typedef typename std::allocator_traits::difference_type difference_type; #else - typedef typename Allocator::reference reference; - typedef typename Allocator::const_reference const_reference; typedef typename Allocator::pointer pointer; typedef typename Allocator::const_pointer const_pointer; typedef typename Allocator::size_type size_type; diff --git a/STL_Extension/include/CGAL/In_place_list.h b/STL_Extension/include/CGAL/In_place_list.h index 62b65a69bc2..86a5b30cf37 100644 --- a/STL_Extension/include/CGAL/In_place_list.h +++ b/STL_Extension/include/CGAL/In_place_list.h @@ -238,24 +238,24 @@ public: // Note: the standard requires the following types to be equivalent // to T, T*, const T*, T&, const T&, size_t, and ptrdiff_t, respectively. // So we don't pass these types to the iterators explicitly. + #ifdef CGAL_CXX11 typedef typename std::allocator_traits::value_type value_type; typedef typename std::allocator_traits::pointer pointer; typedef typename std::allocator_traits::const_pointer const_pointer; - typedef typename std::allocator_traits::reference reference; - typedef typename std::allocator_traits::const_reference const_reference; typedef typename std::allocator_traits::size_type size_type; typedef typename std::allocator_traits::difference_type difference_type; #else typedef typename Allocator::value_type value_type; typedef typename Allocator::pointer pointer; typedef typename Allocator::const_pointer const_pointer; - typedef typename Allocator::reference reference; - typedef typename Allocator::const_reference const_reference; typedef typename Allocator::size_type size_type; typedef typename Allocator::difference_type difference_type; #endif + typedef value_type& reference; + typedef const value_type& const_reference; + typedef internal::In_place_list_iterator iterator; typedef internal::In_place_list_const_iterator const_iterator;