Skip to content

Conversation

JohelEGP
Copy link
Contributor

Resolves #900.
Supersedes #917.

In the original overload, ((t < T{}) != (u < U{})) is only ever reached when is_different_signedness is true, which is only ever true for arithmetic types because the same applies to std::is_signed<T>::value which is_different_signedness is initialized from. So we use std::is_arithmetic<T>::value to add an overload.

@JordanMaples JordanMaples merged commit 8a4b9ed into microsoft:main Jun 23, 2021
@JohelEGP JohelEGP deleted the unordered_narrow branch June 23, 2021 22:29
sakibguy added a commit to sakibguy/GSL that referenced this pull request Jun 29, 2021
feat: narrow for non totally ordered types (microsoft#986)
mbeutel added a commit to gsl-lite/gsl-lite that referenced this pull request May 7, 2025
mbeutel added a commit to gsl-lite/gsl-lite that referenced this pull request May 19, 2025
* Modernize CMake build scripts, add presets
* General cleanup and modernization
* Migrate to namespace `gsl_lite`

Add `gsl_FEATURE_GSL_COMPATIBILITY_MODE` for toggling the `namespace gsl` alias and the `Expects()` and `Ensures()` macros.

* Remove `Owner()` and `implicit` macros

* Simplify `finally()`, `on_return()`, and `on_error()` implementation

...by removing the barely usable pre-C++11 implementation, disallowing moves for C++17 and newer, and defining `uncaught_exceptions()` as returning `int`.

* Add checks and warnings for non-standard ABI, and `gsl_CONFIG_ACKNOWLEDGE_NONSTANDARD_ABI` switch for suppressing ABI warnings

* Add link-time ABI incompatibility detection for MSVC using `#pragma detect_mismatch()`

* Avoid defining type traits conditionally (except for `integral_constant<>`, which I'd rather not compromise)

* Add CppCoreCheck testing with `gsl_lite` namespace

* Include `<version>` header if available

We are already using version checks at various places, implicitly relying on the header having been included through other headers.

* For libc++, configure `_LIBCPP_HARDENING_MODE` rather than `_LIBCPP_DEBUG`

...since the former has superseded the latter.

* Implement `span<>` with static extent

We adapt the `span_iterator<>` implementation, most of the `span<>` implementation, and several unit tests from Microsoft GSL. The new implementation also features the special container unwrapping support for the Microsoft STL.

* Remove deprecated span constructors from reference, `unique_ptr<>`, `shared_ptr<>`

* Remove deprecated span member functions `at()` and `operator()` for indexing

* Remove deprecated span member functions `length()`, `length_bytes()`, `as_bytes()`, `as_writeable_bytes()`

* Deprecate unsafe member function `as_span<>()`

* Un-deprecate span construction from `array<T const, N>` (not sure why this was deprecated)

* Remove deprecated `make_span()` overloads

* Remove deprecated functions `as_writeable_bytes()`, `basic_string_span<>::operator()`

* Implement `narrow<>()` and `narrow_failfast<>()` for non totally ordered types

Borrowing from microsoft/GSL#986 (thanks @JordanMaples).

* Define uncaught-exceptions internals before using them

* Lower CMake version requirement to 3.16

...as currently required for our AppVeyor builds

* Fix `gsl_STATIC_ASSERT_()` for C++98

That is embarrassing. How did it go unnoticed?

* Remove pre-C++11 `owner<>`

* Expand `gsl_ELIDE_()` to a no-op to avoid empty statements

* Update readme, add documentation

* Add package manager example projects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: narrow for non totally ordered types
2 participants