-
Notifications
You must be signed in to change notification settings - Fork 228
Add if constexpr macro and replace condition macro. #1168
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| // Boost.Geometry (aka GGL, Generic Geometry Library) | ||
|
|
||
| // Copyright (c) 2012-2020 Barend Gehrels, Amsterdam, the Netherlands. | ||
| // Copyright (c) 2022 Adam Wulkiewicz, Lodz, Poland. | ||
| // Copyright (c) 2022-2023 Adam Wulkiewicz, Lodz, Poland. | ||
|
|
||
| // This file was modified by Oracle on 2017-2022. | ||
| // Modifications copyright (c) 2017-2022 Oracle and/or its affiliates. | ||
|
|
@@ -44,7 +44,7 @@ | |
| #include <boost/geometry/strategies/buffer.hpp> | ||
| #include <boost/geometry/strategies/side.hpp> | ||
|
|
||
| #include <boost/geometry/util/condition.hpp> | ||
| #include <boost/geometry/util/constexpr.hpp> | ||
| #include <boost/geometry/util/math.hpp> | ||
| #include <boost/geometry/util/type_traits.hpp> | ||
|
|
||
|
|
@@ -942,17 +942,17 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator | |
| { | ||
| boost::ignore_unused(visit_pieces_policy); | ||
|
|
||
| typedef detail::buffer::buffered_piece_collection | ||
| < | ||
| typename geometry::ring_type<GeometryOutput>::type, | ||
| Strategies, | ||
| DistanceStrategy, | ||
| RobustPolicy | ||
| > collection_type; | ||
| using collection_type = detail::buffer::buffered_piece_collection | ||
| < | ||
| typename geometry::ring_type<GeometryOutput>::type, | ||
| Strategies, | ||
| DistanceStrategy, | ||
| RobustPolicy | ||
| >; | ||
| collection_type collection(strategies, distance_strategy, robust_policy); | ||
| collection_type const& const_collection = collection; | ||
|
|
||
| bool const areal = util::is_areal<GeometryInput>::value; | ||
| static constexpr bool areal = util::is_areal<GeometryInput>::value; | ||
|
|
||
| dispatch::buffer_inserter | ||
| < | ||
|
|
@@ -969,7 +969,7 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator | |
| robust_policy, strategies); | ||
|
|
||
| collection.get_turns(); | ||
| if (BOOST_GEOMETRY_CONDITION(areal)) | ||
| if BOOST_GEOMETRY_CONSTEXPR (areal) | ||
| { | ||
| collection.check_turn_in_original(); | ||
| } | ||
|
|
@@ -989,7 +989,7 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator | |
| // phase 1: turns (after enrichment/clustering) | ||
| visit_pieces_policy.apply(const_collection, 1); | ||
|
|
||
| if (BOOST_GEOMETRY_CONDITION(areal)) | ||
| if BOOST_GEOMETRY_CONSTEXPR (areal) | ||
| { | ||
| collection.deflate_check_turns(); | ||
| } | ||
|
|
@@ -1001,8 +1001,7 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator | |
| // - the output is counter clockwise | ||
| // and avoid reversing twice | ||
| bool reverse = distance_strategy.negative() && areal; | ||
| if (BOOST_GEOMETRY_CONDITION( | ||
| geometry::point_order<GeometryOutput>::value == counterclockwise)) | ||
| if BOOST_GEOMETRY_CONSTEXPR (geometry::point_order<GeometryOutput>::value == counterclockwise) | ||
| { | ||
| reverse = ! reverse; | ||
| } | ||
|
|
@@ -1011,9 +1010,12 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator | |
| collection.reverse(); | ||
| } | ||
|
|
||
| if (BOOST_GEOMETRY_CONDITION(distance_strategy.negative() && areal)) | ||
| if BOOST_GEOMETRY_CONSTEXPR (areal) | ||
| { | ||
| collection.discard_nonintersecting_deflated_rings(); | ||
| if (distance_strategy.negative()) | ||
| { | ||
| collection.discard_nonintersecting_deflated_rings(); | ||
| } | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks better than the original code |
||
|
|
||
| collection.template assign<GeometryOutput>(out); | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,27 @@ | ||
| // Boost.Geometry | ||
|
|
||
| // Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland. | ||
|
|
||
| // Use, modification and distribution is subject to the Boost Software License, | ||
| // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | ||
| // http://www.boost.org/LICENSE_1_0.txt) | ||
|
|
||
| #ifndef BOOST_GEOMETRY_UTIL_CONSTEXPR_HPP | ||
| #define BOOST_GEOMETRY_UTIL_CONSTEXPR_HPP | ||
|
|
||
|
|
||
| #include <boost/geometry/util/condition.hpp> | ||
|
|
||
|
|
||
| #ifndef BOOST_NO_CXX17_IF_CONSTEXPR | ||
|
|
||
| #define BOOST_GEOMETRY_CONSTEXPR(CONDITION) constexpr (CONDITION) | ||
|
|
||
| #else | ||
|
|
||
| #define BOOST_GEOMETRY_CONSTEXPR(CONDITION) (BOOST_GEOMETRY_CONDITION(CONDITION)) | ||
|
|
||
| #endif | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
|
||
| #endif // BOOST_GEOMETRY_UTIL_CONSTEXPR_HPP | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I like it