Skip to content

Conversation

@awulkiew
Copy link
Member

@awulkiew awulkiew commented Jul 1, 2023

This is a proposal adding conditional support of C++17 if constexpr. I modified only several files for now so we can start a discussion. If we have an agreement I'll modify other places.

My intention was to have a solution as close as possible to the original language feature and to keep if keyword so editors can highlight it as usual, i.e.:

if constexpr (static_condition)

vs

if BOOST_GEOMETRY_CONSTEXPR (static_condition)

It's a followup of #1160

@awulkiew awulkiew added this to the 1.83 milestone Jul 1, 2023
@awulkiew awulkiew force-pushed the feature/constexpr branch from c6e83fd to 9684581 Compare July 1, 2023 19:28
Copy link
Collaborator

@barendgehrels barendgehrels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this approach, thank you!

#define BOOST_GEOMETRY_CONSTEXPR(CONDITION) (BOOST_GEOMETRY_CONDITION(CONDITION))

#endif

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


collection.get_turns();
if (BOOST_GEOMETRY_CONDITION(areal))
if BOOST_GEOMETRY_CONSTEXPR (areal)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it

{
collection.discard_nonintersecting_deflated_rings();
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better than the original code

Copy link
Member

@vissarion vissarion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks great!

@vissarion vissarion merged commit 592024e into boostorg:develop Jul 4, 2023
@awulkiew
Copy link
Member Author

awulkiew commented Jul 4, 2023

@vissarion Thanks! This wasn't finished though. I'll create another PR with the rest. :)

@vissarion
Copy link
Member

@vissarion Thanks! This wasn't finished though. I'll create another PR with the rest. :)

I know. I just merged it since there were the 1.83 and the enhancement labels and the beta is closing today. I guess there is no problem to have the rest of the support in 1.84.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants