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

operator[] not constexpr with contract checking on #71

Closed CrustyAuklet closed 3 years ago

CrustyAuklet commented 3 years ago

I am doing a little work on my constexpr bitpacking library and wanted to upgrade nonstd::span from 0.7.0 to 0.10.0. In doing so I noticed that operator[] is no longer constexpr if contracts are on. If I simply mark impl::is_positive as constexpr then all my tests pass. Unlike #70 I don't want to disable bounds checking, I like to leave it on in debug builds to enforce the contracts.

Seems like a trivial change, but i can open a MR if you would like. I have the change in my fork and all your tests passed.

martinmoene commented 3 years ago

Thanks!