Skip to content

refactor: consolidate Dash-specific utils between C++23 polyfills (util/std23.h) and helpers (util/helpers.h)#7098

Merged
PastaPastaPasta merged 12 commits intodashpay:developfrom
kwvg:cxx23_pf
Mar 12, 2026
Merged

refactor: consolidate Dash-specific utils between C++23 polyfills (util/std23.h) and helpers (util/helpers.h)#7098
PastaPastaPasta merged 12 commits intodashpay:developfrom
kwvg:cxx23_pf

Conversation

@kwvg
Copy link
Collaborator

@kwvg kwvg commented Jan 10, 2026

Motivation

The upgrade to C++20 (dash#6380) allowed us to drop most of our polyfills meant as bridge from C++17, though we still have utils beyond the ones inherited from upstream that have accumulated over time, most of them, seeking to bridge C++23 features while others are entirely custom or serve as convenience functions or thin wrappers.

Some of them include:

This pull requests compacts all of those helpers into two files:

  • util/helpers.h (custom helpers, replacing util/irange.h, util/pointer.h, util/ranges.h)
  • util/std23.h (polyfill for C++23, replacing util/enumerate.h and util/underlying.h)

And additionally, introduces additional capabilities utilised in Dash-specific code:

Additional Information

  • ToUnderlying() needed to be renamed to to_underlying() to match with the standard library naming so we can discontinue the polyfill easily when we migrate to C++23 by just going s/std23/std/g.

  • While iranges::range is equivalent to std::views::iota, the latter requires both min and max to be of the same type but literal 0 has a type incompatible with size_t, requiring size_t{0} to compile. As propagation of these changes for each instance is bothersome, util::irange() exists as a thin wrapper that wraps the literal around the type for max

Breaking Changes

None expected.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation (note: N/A)
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants