Opened 7 months ago

Last modified 10 days ago

#829 new enhancement

C++20

Reported by: Olly Betts Owned by: Olly Betts
Priority: normal Milestone: 2.0.0
Component: Build system Version: git master
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description (last modified by Olly Betts)

Ticket to note things we can take advantage of once we require C++20:

  • Heterogeneous comparison lookup for unordered containers - std::unordered_set, etc. StemStopper::stop_words, TermListGroup::termfreq/TermListGroup::get_termfreq, PointType::contains/PointType::get_weight. (We get this for ordered containers in C++14.)

Change History (3)

comment:1 by Olly Betts, 7 months ago

Component: OtherBuild system
Description: modified (diff)
Milestone: 1.5.0
Version: git master

At least for stuff like the above and where the difference isn't exposed in the API headers, we can probably use the __cpp_-prefixed feature macros to opportunistically use the new way with a fall-back to creating a temporary std::string. We can then probe for C++20 in configure and enable if supported by the compiler, with a fallback to C++17.

comment:2 by Olly Betts, 7 months ago

Milestone: 1.5.02.0.0

We can then probe for C++20 in configure and enable if supported by the compiler, with a fallback to C++17.

d3778ed6718d5f638c362e35354947955b78cb52 adds a probe for C++23 with fallback to C++20 then C++17.

We conditionally check for __cpp_lib_associative_heterogeneous_erasure (C++23) currently (also __cpp_lib_associative_heterogeneous_insertion but that's due for C++26). Further such conditionalised uses aren't ABI changing so don't need to block starting a new release series.

comment:3 by Olly Betts, 10 days ago

C++20 provides a standard way to query endianness (currently probed by configure): https://en.cppreference.com/w/cpp/types/endian

Note: See TracTickets for help on using tickets.