Looks like somewhere along the line, the iOS simulator changed the range
of support iOS versions. This changes bumps the version from 9 to 12.0.
Also noticed that the GSL OSX bundle version was quite out of date. I
bumped this from 3.1.0 to 4.2.0 and created an upgrade checklist file in
docs/ so we don't forget these types of tasks in the future.
There is a static assertion that spuriously fails on MSVC that was
version checked. Unfortunately it fires every time there is a new
compiler update, so for now we will remove the version check and add it
back once the compiler bug is fixed.
- A macro with the very generic name `BYTE_TYPE` is likely to collide with existing code, so get rid of the macro.
- The new solution is to provide a non-deprecated `byte` in the namespace `gsl::impl`.
- Users of GSL should use `gsl::byte`, which is still deprecated when mapped to a `std::std::byte`.
- GSL types and functions need to use `gsl::impl::byte` so they do not trigger the deprecation warning.
- The `gsl::impl::byte` return type in an exported function is not nice, it might mislead users to use that type in their own declarations. But the `BYTE_TYPE` solution is not better in this respect.
Co-authored-by: Werner Henze <w.henze@avm.de>
- reintroduce documentation internal links
- remove `gsl::` prefix in table so it is the same as in the other tables
- fix documentation for span::element_type
Co-authored-by: Werner Henze <w.henze@avm.de>
* deprecated features adopted into C++
1) Mark the following GSL features as deprecated:
- gsl::unique_ptr (always)
- gsl::shared_ptr (always)
- gsl::byte (since c++17)
- gsl::joining_thread (never implemented)
2) Refactor existing deprecations to use the new GSL_DEPRECATED(msg) macro.
3) Create a section in the README for deprecated features in the
standard.
* do not deprecate gsl::to_integer because we never claim to implement it.
* do not use gsl::byte if it is deprecated
Reverts commit that changes #include "assert" -> #include "gsl/assert".
This change is necessary in order to comply with CppCoreGuideline's
SF.12. Now we do #include "./assert".
* Add more gsl::span tests [copilot]
This PR adds comprehensive unit tests for `gsl::span` to ensure its correctness and consistency. The following tests have been added:
1. **Empty Span Tests**:
- Tests to verify the behavior of an empty `gsl::span` and `gsl::span<const int>`.
2. **Conversion Tests**:
- Tests to check the conversion between different types of `gsl::span`.
3. **Comparison Operator Tests**:
- Tests to verify the comparison operators for `gsl::span`.
4. **Deduction Guide Tests**:
- Tests to compare the behavior of `gsl::span` and `std::span` deduction guides for various types of arrays and containers.
These tests help ensure that `gsl::span` behaves correctly in various scenarios and is consistent with `std::span`.
This PR was created with the help of GitHub Copilot.
**Changes**:
- Added tests for empty span.
- Added tests for conversions.
- Added tests for comparison operators.
- Added tests for deduction guides.
**Testing**:
- All new tests have been added to the existing test suite.
- Run the test suite using `ctest` to ensure all tests pass.This PR adds comprehensive unit tests for `gsl::span` to ensure its correctness and consistency. The following tests have been added:
1. **Empty Span Tests**:
- Tests to verify the behavior of an empty `gsl::span` and `gsl::span<const int>`.
2. **Conversion Tests**:
- Tests to check the conversion between different types of `gsl::span`.
3. **Comparison Operator Tests**:
- Tests to verify the comparison operators for `gsl::span`.
4. **Deduction Guide Tests**:
- Tests to compare the behavior of `gsl::span` and `std::span` deduction guides for various types of arrays and containers.
These tests help ensure that `gsl::span` behaves correctly in various scenarios and is consistent with `std::span`.
This PR was created with the help of GitHub Copilot.
**Changes**:
- Added tests for empty span.
- Added tests for conversions.
- Added tests for comparison operators.
- Added tests for deduction guides.
**Testing**:
- All new tests have been added to the existing test suite.
- Run the test suite using `ctest` to ensure all tests pass.
* fix tests for pre-C++17
Office is seeing build breaks due to `#include "span"` including
C++20 span instead of gsl/span. Most likely we want all headers
includes qualified with "gsl/" to avoid similar issues.
- `strict_not_null<std::unique_ptr<int>>{ std::make_unique<int>()}` failed to compile
- `strict_not_null` ctor needs to move the passed `unique_ptr`, not copy
- Copied `not_null` `TestNotNullConstructors` for `strict_not_null`
- The `noexcept` specifiers on the `strict_not_null` and `not_null` constructors were out of sync.
- Added unit test for `not_null<unique_ptr<T>>` and for `strict_not_null<unique_ptr<T>>`
- Added unit test for `gsl::swap` for two `strict_not_null`
- Added unit test for `gsl::swap` for `not_null` and `strict_not_null`
Co-authored-by: Werner Henze <w.henze@avm.de>
When setting `GSL_USE_STD_BYTE` to zero, then the unit test does not compile because `byte` is ambiguous (could be `std::byte` or `gsl::byte`). So `gsl::` prefix is needed for `byte`.
It looks like the unit tests never ran on a platform where `gsl::byte` is not based on `std::byte`.
It does not make much sense to test `std::byte` for compliance, so make the unit tests based on the GSL implementation of `gsl::byte` (`#define GSL_USE_STD_BYTE 0`).
Co-authored-by: Werner Henze <werner.henze+gitcommits@posteo.de>
`std::enable_if_t` must not be used as a default template argument, otherwise the instantiator will be able to override it freely with something that doesn't fail substitution. Instead, `std::enable_if_t` itself must be the type of the template argument.
More information in the examples here: https://en.cppreference.com/w/cpp/types/enable_if
* fix failing pipeline tests
* upgrade to googletest v1.14.0 so it works with newer cmake versions
* fix android pipeline to permit new cmake versions (short-term fix)
* improve performance of span_iterator w/ clang
Issue: #1165
Before this PR, the range-for loop was ~3300x slower. After this PR, it
is ~1.005x slower
The clang optimizer is very good at optimizing `current != end`, so
we changed to this idiom. This moves the Expects assertion into the
constructor instead of on the hot-path which is called whenever either
operator++ or operator* is called.
Note: The codegen for the assertion is still a missed optimization,
but less worrisome as it only happens once per iterator.
Note: benchmarks on M1 Macbook Pro w/ Apple Clang 16.0.0
* Remove unused headers from gsl/pointers
forward is already declared in utility, no need to include algorithm which is relativaly heavy
hash is already declared in memory, no need to bring brand-new header system_error for hash only
* Fix: add missing header <functional> to gsl/pointers due to using less/greater
move pipeline testing from AzDO to GitHub Actions.
* update clang versions to 13-15
* update gcc versions to 10-12
* update xcode versions to 14.3.1 and 15.4
* test against C++23 (where supported)
Job has been failing for months and is preventing other PRs from getting
merged. This PR fixes the pipeline - it changed the following:
- runs on macos-latest-large (which is a non-arm image)
- starts the emulator under java8 (see
https://learn.microsoft.com/en-us/java/openjdk/transition-from-java-8-to-java-11)
- runs emulator with -no-audio
The above were requirements to get the pipeline running. Other changes
include the following:
- The job will auto-cancel when a newer commit is pushed to the
PR.
- The 'Wait for emulator ready' step now has a 2 minute timeout. This
is necessary because we get no indication on whether or not the
command that started the emulator suceeded. I believe there is room
for improvement here, but it is outside the scope of the PR.