-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
STL extension: Add a template argument to Prevent_deref for the value…
… type (#7410) ## Summary of Changes Fix issue #7400 ## Release Management * Affected package(s): Triangulation_2, Triangulation_3, STL_extension * Issue(s) solved (if any): fix #7400 * License and copyright ownership: unchanged
- Loading branch information
Showing
16 changed files
with
164 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#include <type_traits> | ||
#include <iterator> | ||
#include <CGAL/type_traits.h> | ||
|
||
// Add C++20 utilities to C++14 | ||
template <class Iterator> | ||
using iter_value_t = std::remove_reference_t<decltype(*std::declval<Iterator>())>; | ||
|
||
template<class Range> | ||
using range_value_t = iter_value_t<CGAL::cpp20::remove_cvref_t<decltype(std::begin(std::declval<Range>()))>>; | ||
|
||
template< class T, class U > | ||
constexpr bool is_same_v = std::is_same<T, U>::value; | ||
|
||
template< class T, class U > | ||
constexpr bool is_convertible_v = std::is_convertible<T, U>::value; | ||
|
||
|
||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> | ||
#include <CGAL/Triangulation_3.h> | ||
|
||
using Triangulation = CGAL::Triangulation_3<CGAL::Exact_predicates_inexact_constructions_kernel>; | ||
|
||
using Vertex_handle = Triangulation::Vertex_handle; | ||
|
||
Triangulation t; | ||
|
||
// Tds::vertex_handles() -> Vertex_handle | ||
static_assert(is_same_v<range_value_t<decltype(t.tds().vertex_handles())>, const Vertex_handle>); | ||
|
||
// Triangulation::all_vertex_handles() -> Vertex_handle | ||
static_assert(is_same_v<range_value_t<decltype(t.all_vertex_handles())>, const Vertex_handle>); | ||
|
||
// Triangulation::finite_vertex_handles() -> convertible to Vertex_handle | ||
static_assert(is_convertible_v<decltype(*std::begin(t.finite_vertex_handles())), Vertex_handle>); | ||
|
||
// But is it equal to Vertex_handle | ||
static_assert(is_same_v<range_value_t<decltype(t.finite_vertex_handles())>, const Vertex_handle>); | ||
|
||
int main() | ||
{ | ||
Vertex_handle v_inf = t.infinite_vertex(); | ||
for(auto v: t.finite_vertex_handles()) { | ||
Vertex_handle v2 = v; | ||
CGAL_USE(v2); | ||
if(v == v_inf) return 1; | ||
} | ||
for (auto v : t.all_vertex_handles()) { | ||
Vertex_handle v2 = v; | ||
CGAL_USE(v2); | ||
if (v == v_inf) std::cout << "found inf" << std::endl; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.