-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Using std::optional for Property_container::get<T> #8035
Using std::optional for Property_container::get<T> #8035
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class Pair_optional_adaptor<T>
has four data members:
- its base class, of type
std::optional<T>
, T &first
andbool second
for the compatibility withstd::pair<T, bool>
,- and
t_storage
(I am not sure why it is an union instead of a plainT
).
That makes that class source-incompatible with:
auto [pmap, ok] = point.get<Foo>("bar");
See live on compiler explorer: https://godbolt.org/z/3xY6qzPTq
I am in favor of a real breaking change:
|
I used the union originally to avoid construction of T in case there is no default constructor. Sebastien mentioned already that T will be some lightweight object anyway that has to be default constructible for being put into a pair. The PR is still WIP. I made it work locally for Surface_mesh and Point_set_3 and then created the PR to see if this works in the CI. So, I'll remove the union and switch to a plain T. |
We decided during meeting to break the compatibility and use std::optional directly. |
@sloriot, in a message dated Feb 2024:
@sloriot, yesterday:
@sloriot, why is it release blocker? @soesau If this PR is really blocking the next release, then we should hurry. Do you need help on it? |
The API change is possible thanks to |
23cc636
to
a873482
Compare
We decided for a breaking change, thus there will be no adaptor. |
Successfully tested in CGAL-6.0-Ic-245 |
Summary of Changes
Switching from
std::pair<Property_map<T>, bool>
tostd::optional
inProperty_container::get<T>
Introducing
Pair_optional_adaptor
for backward compatibility which extendsstd::optional<T>
to interface ofstd::pair
using
Pair_optional_adaptor
forSurface_mesh
andPoint_set_3
Release Management