Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace boost::optional with std::optional #8695

Open
wants to merge 2 commits into
base: 6.0.x-branch
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h>
#include <CGAL/Tetrahedral_remeshing/internal/property_maps.h>

#include <optional>

namespace CGAL
{
namespace Tetrahedral_remeshing
Expand Down Expand Up @@ -70,16 +72,16 @@ std::size_t peel_slivers(C3T3& c3t3,
Cell_handle c = c_i.first;
const std::array<bool, 4>& f_on_surface = c_i.second;

boost::optional<Surface_patch_index> patch;
std::optional<Surface_patch_index> patch;
for (int i = 0; i < 4; ++i)
{
if (f_on_surface[i])
{
Surface_patch_index spi = c3t3.surface_patch_index(c, i);
if (patch != boost::none && patch.get() != spi)
if (patch.has_value() && patch.value() != spi)
{
//there are 2 different patches
patch = boost::none;
patch.reset();
break;
}
else
Expand All @@ -88,15 +90,15 @@ std::size_t peel_slivers(C3T3& c3t3,
}
}
}
if (patch == boost::none)
if (!patch.has_value())
continue;

for (int i = 0; i < 4; ++i)
{
if (f_on_surface[i])
c3t3.remove_from_complex(c, i);
else
c3t3.add_to_complex(c, i, patch.get());
c3t3.add_to_complex(c, i, patch.value());
}

c3t3.remove_from_complex(c);
Expand Down
17 changes: 9 additions & 8 deletions Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <CGAL/Triangulation_vertex_base_3.h>
#include <CGAL/Triangulation_simplex_3.h>

#include <boost/optional.hpp>
#include <optional>

// If defined, type casting is done statically,
// reducing type-safety overhead.
Expand Down Expand Up @@ -789,8 +789,8 @@ class Triangulation_segment_simplex_iterator_3
}
} else {
auto facet_opt = shared_facet(get_edge(), e_prev);
if(static_cast<bool>(facet_opt)) {
_curr_simplex = *facet_opt;
if(facet_opt.has_value()) {
_curr_simplex = facet_opt.value();
}
else {
_curr_simplex = shared_cell(get_edge(), e_prev);
Expand Down Expand Up @@ -1002,7 +1002,7 @@ class Triangulation_segment_simplex_iterator_3
return f1 == f2 || triangulation().mirror_facet(f1) == f2;
}

boost::optional<Vertex_handle> shared_vertex(const Edge& e1, const Edge& e2) const
std::optional<Vertex_handle> shared_vertex(const Edge& e1, const Edge& e2) const
{
Vertex_handle v1a = e1.first->vertex(e1.second);
Vertex_handle v1b = e1.first->vertex(e1.third);
Expand All @@ -1017,14 +1017,15 @@ class Triangulation_segment_simplex_iterator_3
return {};
}

boost::optional<Facet> shared_facet(const Edge& e1, const Edge& e2) const
std::optional<Facet> shared_facet(const Edge& e1, const Edge& e2) const
{
Vertex_handle v2a = e2.first->vertex(e2.second);
Vertex_handle v2b = e2.first->vertex(e2.third);

auto sv_opt = shared_vertex(e1, e2);
if(!sv_opt) return {};
Vertex_handle sv = *sv_opt;
if(!sv_opt.has_value())
return {};
Vertex_handle sv = sv_opt.value();
Vertex_handle nsv2 = (sv == v2a) ? v2b : v2a;

typename Tr::Facet_circulator circ
Expand Down Expand Up @@ -1091,7 +1092,7 @@ class Triangulation_segment_simplex_iterator_3
}

Cell_handle shared_cell(const Edge e1, const Edge e2) const {
auto facet = shared_facet(e1, e2.first->vertex(e2.second));
Facet facet = shared_facet(e1, e2.first->vertex(e2.second));
return shared_cell(facet, e2.first->vertex(e2.third));
}

Expand Down
Loading