martinmoene / span-lite

span lite - A C++20-like span for C++98, C++11 and later in a single-file header-only library
Boost Software License 1.0
497 stars 41 forks source link

Import `std::dynamic_extent` into `nonstd` when selecting `std::span` #81

Closed wendazhou closed 1 year ago

wendazhou commented 1 year ago

The <span> header not only contains the std::span type, but also the std::dynamic_extent constant. This constant is present and accessible as nonstd::dynamic_extent when using the span-lite implementation, but disappears from the namespace if the std::span implementation is selected.

To avoid this, it would be great to import std::dynamic_extent into the nonstd namespace if using std::span, i.e.

#if span_USES_STD_SPAN

#include <span>

namespace nonstd {

using std::span;
using std::dynamic_extent; // Add this