Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
span_compat.h File Reference

Provides a C++17-compatible span type alias. More...

#include <gsl/span>

Go to the source code of this file.

Namespaces

namespace  momentum

Macros

#define MOMENTUM_HAS_CPP20_SPAN   0
 Defined to 1 when the compiler advertises C++20 (via __cplusplus or MSVC's _MSVC_LANG), 0 otherwise.

Typedefs

template<typename T>
using momentum::span = gsl::span<T>
 Span type alias using gsl::span (C++17 fallback).

Detailed Description

Provides a C++17-compatible span type alias.

This header provides momentum::span<T> which aliases to std::span<T> when C++20 is available, and falls back to gsl::span<T> for C++17 compilers / platforms whose standard library does not yet ship <span> (e.g. older Apple/Clang toolchains, certain Android NDK versions, and any build configured to target C++17).

Note
Use momentum::span<T> everywhere within momentum sources instead of std::span<T> directly, until the project drops C++17 support. Once all supported platforms provide <span>, this shim can be removed and call sites switched to std::span<T>.

Definition in file span_compat.h.

Macro Definition Documentation

◆ MOMENTUM_HAS_CPP20_SPAN

#define MOMENTUM_HAS_CPP20_SPAN   0

Defined to 1 when the compiler advertises C++20 (via __cplusplus or MSVC's _MSVC_LANG), 0 otherwise.

Gates whether <span> or <gsl/span> is included.

Definition at line 33 of file span_compat.h.