From 4c3bfb1eedbb9ce6f155882908d528de509f8c77 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 10 Apr 2019 13:48:04 +0200 Subject: [PATCH 1/4] Add a fucntion to_tuple() to the Dispatch_output_iterator and use it in the test to avoid a clang error on old macs --- STL_Extension/include/CGAL/iterator.h | 11 +++++++++++ .../test/STL_Extension/test_dispatch_output.cpp | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/STL_Extension/include/CGAL/iterator.h b/STL_Extension/include/CGAL/iterator.h index 44238dd2111..f810be17152 100644 --- a/STL_Extension/include/CGAL/iterator.h +++ b/STL_Extension/include/CGAL/iterator.h @@ -1408,6 +1408,16 @@ public: tuple_dispatch(t); return *this; } + + std::tuple& to_tuple() + { + return static_cast&>(*this); + } + + const std::tuple& to_tuple() const + { + return static_cast&> (*this); + } }; template < typename... V, typename... O> @@ -1449,6 +1459,7 @@ public: template Self& operator=(const T&) { return *this; } + }; diff --git a/STL_Extension/test/STL_Extension/test_dispatch_output.cpp b/STL_Extension/test/STL_Extension/test_dispatch_output.cpp index 622e907952b..1f782d23509 100644 --- a/STL_Extension/test/STL_Extension/test_dispatch_output.cpp +++ b/STL_Extension/test/STL_Extension/test_dispatch_output.cpp @@ -76,8 +76,8 @@ void complete_test(std::vector data1,std::list data2){ T1* d; - std::tie(d, bck_ins) = disp; - std::tie(d, bck_ins) = drop; + std::tie(d, bck_ins) = disp.to_tuple(); + std::tie(d, bck_ins) = drop.to_tuple(); //testing putting the tuple directly std::tuple tuple = From a7361a3444943197c8b7932ca607bae1a2d5554e Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 10 Apr 2019 14:08:37 +0200 Subject: [PATCH 2/4] Clean-up --- STL_Extension/include/CGAL/iterator.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/STL_Extension/include/CGAL/iterator.h b/STL_Extension/include/CGAL/iterator.h index f810be17152..ee140e1346e 100644 --- a/STL_Extension/include/CGAL/iterator.h +++ b/STL_Extension/include/CGAL/iterator.h @@ -1416,7 +1416,7 @@ public: const std::tuple& to_tuple() const { - return static_cast&> (*this); + return static_cast&> (*this); } }; @@ -1459,7 +1459,7 @@ public: template Self& operator=(const T&) { return *this; } - + }; From 920133b7853cec71f4dc50debe36c4dfc3c47cb9 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 12 Apr 2019 14:29:24 +0200 Subject: [PATCH 3/4] Replace to_tuple() by operator std::tuple --- STL_Extension/include/CGAL/iterator.h | 17 +++++++++++++---- .../test/STL_Extension/test_dispatch_output.cpp | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/STL_Extension/include/CGAL/iterator.h b/STL_Extension/include/CGAL/iterator.h index ee140e1346e..8d40cec8c38 100644 --- a/STL_Extension/include/CGAL/iterator.h +++ b/STL_Extension/include/CGAL/iterator.h @@ -43,6 +43,7 @@ #include #include +#include namespace CGAL { @@ -1324,6 +1325,14 @@ struct Derivator, std::tuple > } // internal +namespace tuple_internal { +template +auto to_tuple(std::tuple &t, std::index_sequence) +{ + return std::tuple(std::get(t)...); +} + +}//end namespace tuple_internal // OutputIterator which accepts several types in *o++= and dispatches, // wraps several other output iterators, and dispatches accordingly. @@ -1409,14 +1418,14 @@ public: return *this; } - std::tuple& to_tuple() + operator std::tuple() { - return static_cast&>(*this); + return tuple_internal::to_tuple(*this, std::index_sequence_for{}); } - const std::tuple& to_tuple() const + operator std::tuple()const { - return static_cast&> (*this); + return tuple_internal::to_tuple(*this, std::index_sequence_for{}); } }; diff --git a/STL_Extension/test/STL_Extension/test_dispatch_output.cpp b/STL_Extension/test/STL_Extension/test_dispatch_output.cpp index 1f782d23509..622e907952b 100644 --- a/STL_Extension/test/STL_Extension/test_dispatch_output.cpp +++ b/STL_Extension/test/STL_Extension/test_dispatch_output.cpp @@ -76,8 +76,8 @@ void complete_test(std::vector data1,std::list data2){ T1* d; - std::tie(d, bck_ins) = disp.to_tuple(); - std::tie(d, bck_ins) = drop.to_tuple(); + std::tie(d, bck_ins) = disp; + std::tie(d, bck_ins) = drop; //testing putting the tuple directly std::tuple tuple = From ff012669f5a8b272ff55abb51b412d4ffe7f52d5 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 16 Apr 2019 10:12:11 +0200 Subject: [PATCH 4/4] enable c++14 in check_headers --- Scripts/developer_scripts/cgal_check_dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/developer_scripts/cgal_check_dependencies.sh b/Scripts/developer_scripts/cgal_check_dependencies.sh index 65b989a8ca2..0a8d7b34e14 100644 --- a/Scripts/developer_scripts/cgal_check_dependencies.sh +++ b/Scripts/developer_scripts/cgal_check_dependencies.sh @@ -30,7 +30,7 @@ do fi done -cmake -DCGAL_HEADER_ONLY=FALSE -DCGAL_ENABLE_CHECK_HEADERS=TRUE -DDOXYGEN_EXECUTABLE="$DOX_PATH" -DCGAL_COPY_DEPENDENCIES=TRUE -DCMAKE_CXX_FLAGS="-std=c++11" .. +cmake -DCGAL_HEADER_ONLY=FALSE -DCGAL_ENABLE_CHECK_HEADERS=TRUE -DDOXYGEN_EXECUTABLE="$DOX_PATH" -DCGAL_COPY_DEPENDENCIES=TRUE -DCMAKE_CXX_FLAGS="-std=c++14" .. if [ -n "$DO_CHECK_HEADERS" ]; then make -j$(nproc --all) -k check_headers fi