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

Bump minimum C++ standard to 17 #1144

Merged
merged 1 commit into from
Sep 25, 2024
Merged

Bump minimum C++ standard to 17 #1144

merged 1 commit into from
Sep 25, 2024

Conversation

hobu
Copy link
Member

@hobu hobu commented Aug 16, 2024

As titled, this bumps our floor to C++17. It is proposed to implement this for GEOS 3.14+, not GEOS 3.13, which is expected soon.

The C++11 RFC has this comment:

Is there a plan to upgrade to C++14 or C++17 to allow use of the C++ latest features? No, there is no plan. It is, however, recognized, such motion may be put to the vote around 2020.

I think that given we are near the end of 2024, it's time to finally increment. I don't think it requires an RFC due to us lagging the increment of many other projects and compilers on the systems that GEOS is used on. It was the C++11 increment that was disruptive and C++17 is not expected to be this late in the cycle.

@pramsey
Copy link
Member

pramsey commented Aug 16, 2024

What are the c++17 features we're dying to get our hot little hands on?

@rouault
Copy link
Contributor

rouault commented Aug 16, 2024

What are the c++17 features we're dying to get our hot little hands on?

Actually a C++14 feature:

std::unique_ptr<CoordinateSequence> linePts(new CoordinateSequence());

==>

auto linePts = std::make_unique<CoordinateSequence>();

The fact that CI passes without any change shows that this is a no-brainer change

@dbaston
Copy link
Member

dbaston commented Aug 16, 2024

What are the c++17 features we're dying to get our hot little hands on?

Some things I use:

  • if constexpr (lets you avoid template boilerplate)
  • structured bindings ( for( const auto& [key, value] : map) )
  • std::optional, to avoid signatures like bool mayybeGetDouble(double& d)
  • inline member variables, lets you avoid initializing static member variables outside of the class definition
  • std::variant and std::any
  • std::string_view

I haven't used them, but parallel STL algorithms may be useful for GEOS.

@robe2 robe2 added this to the 3.14.0 milestone Aug 17, 2024
@robe2 robe2 assigned robe2 and unassigned robe2 Aug 21, 2024
@robe2 robe2 requested review from pramsey, dr-jts and robe2 August 21, 2024 19:55
Copy link
Member

@pramsey pramsey left a comment

Choose a reason for hiding this comment

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

OK with this, obvs wait until 3.13 is branched before merging.

@dbaston
Copy link
Member

dbaston commented Sep 25, 2024

Are we ready to merge this? Just found myself reaching for an if constexpr and it wasn't there...

@pramsey
Copy link
Member

pramsey commented Sep 25, 2024

Are we ready to merge this? Just found myself reaching for an if constexpr and it wasn't there...

Yes

@dbaston dbaston merged commit e142764 into libgeos:main Sep 25, 2024
28 checks passed
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.

5 participants