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

## Summary of Changes

Some occurrences that slipped through.

See https://github.com/CGAL/cgal/pull/7526

## Release Management

* Affected package(s): `Tetrahedral_remeshing`, `Triangulation_3`
* Issue(s) solved (if any): -
* Feature/Small Feature (if any): - 
* License and copyright ownership: no change
This commit is contained in:
Sebastien Loriot 2025-01-20 10:13:50 +01:00 committed by GitHub
commit 816cd11e3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 13 deletions

View File

@ -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
@ -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
@ -88,7 +90,7 @@ std::size_t peel_slivers(C3T3& c3t3,
}
}
}
if (patch == boost::none)
if (!patch.has_value())
continue;
for (int i = 0; i < 4; ++i)
@ -96,7 +98,7 @@ std::size_t peel_slivers(C3T3& c3t3,
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);

View File

@ -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.
@ -789,8 +789,8 @@ public:
}
} 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);
@ -1002,7 +1002,7 @@ private:
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);
@ -1017,14 +1017,15 @@ private:
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
@ -1091,7 +1092,7 @@ private:
}
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));
}