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
499 stars 43 forks source link

Add C++98 compatible free functions first() etc. taking a span #67

Closed martinmoene closed 3 years ago

martinmoene commented 3 years ago

Continuation of #65 .

Add C++98 compatible free functions first() etc. taking a span<T,Extent>, such as:

template< extent_t Count, class T, extent_t Extent >
span_constexpr span<T, Count>
first( span<T, Extent> spn );

template< class T, extent_t Extent >
span_constexpr span<T>
first( span<T, Extent> spn, size_t count );

Add configuration macros:

span_FEATURE_NON_MEMBER_FIRST_LAST_SUB_SPAN
span_FEATURE_NON_MEMBER_FIRST_LAST_SUB_CONTAINER

Let span_FEATURE_NON_MEMBER_FIRST_LAST_SUB=1 activate both.

martinmoene commented 3 years ago

Closing this now, feel free to reopen if needed.