Skip to content

Add C++17-compatible span wrapper for math module#1155

Open
cdtwigg wants to merge 2 commits into
mainfrom
export-D96328572
Open

Add C++17-compatible span wrapper for math module#1155
cdtwigg wants to merge 2 commits into
mainfrom
export-D96328572

Conversation

@cdtwigg

@cdtwigg cdtwigg commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Summary:
Introduce momentum::span<T> type alias that maps to std::span<T> on C++20
compilers and gsl::span<T> on C++17 compilers. This enables the math module
to build on platforms with C++17-only support.

  • Add math/span_compat.h with C++20 detection and span type alias
  • Update all math module files to use momentum::span instead of std::span
  • Fix double-promotion warning in mppca.cpp (0.5 -> T(0.5))

Reviewed By: fantaosha

Differential Revision: D96328572

Ivan Shugurov added 2 commits March 17, 2026 14:42
Summary:

Add support for building without C++ exceptions in the common module.

- exception.h: Detect whether C++ exceptions are enabled via
  __cpp_exceptions, __EXCEPTIONS, or _CPPUNWIND. On platforms built with
  -fno-exceptions, the MT_THROW macros fall back to fprintf(stderr) + abort()
  instead of throwing.
- Split progress_bar into a separate library to allow the common module to
  build on platforms without terminal I/O headers.

Differential Revision: D96328571
Summary:
Introduce `momentum::span<T>` type alias that maps to `std::span<T>` on C++20
compilers and `gsl::span<T>` on C++17 compilers. This enables the math module
to build on platforms with C++17-only support.

- Add math/span_compat.h with C++20 detection and span type alias
- Update all math module files to use momentum::span instead of std::span
- Fix double-promotion warning in mppca.cpp (0.5 -> T(0.5))

Reviewed By: fantaosha

Differential Revision: D96328572
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 17, 2026
@meta-codesync

meta-codesync Bot commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

@cdtwigg has exported this pull request. If you are a Meta employee, you can view the originating Diff in D96328572.

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

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant