Announcing Guidelines Support Library v4.2.0 - C++ Team Blog (original) (raw)

GSL is an implementation of the Guidelines Support Library specified by theC++ Core Guidelines. It provides types and functions that help C++ developers write safer, more maintainable code while following modern C++ best practices.

We are excited to announce the release of GSL v4.2.0! This release brings significant performance improvements, new features, and important updates that align GSL with modern C++ standards.

Performance Boost for Span Iterator

One of the most notable changes in this release is the significant performance improvements of span_iterator when using the Clang compiler. Previously, gsl::spaniterators could be up to 20 times slower than std::span under various workloads (range-for, <algorithm>, etc.). Through reorganization of the code and moving access-checks out of the hot path, we have achieved performance parity for most workloads (see #1168). This ABI-preserving improvement makes gsl::span a more practical choice for code that is both safe and fast.

New Features and Improvements

As the C++ Core Guidelines evolve with modern C++ practices, GSL continues to adapt and grow. Working closely with the community, we’ve implemented key enhancements that make GSL more robust and easier to use in modern C++ codebases. These updates focus on type safety, modern idioms, and better template support — areas crucial for production code. Here are some of the key improvements since version 4.1.0:

Alignment with C++ Standards

As part of our commitment to keeping GSL aligned with modern C++ development, we are deprecating features that have been adopted into the C++ standard library. We recommend using the C++ standard library equivalents for these features when possible. Here are the features that have been deprecated in this release:

Additionally, we have removed the long-deprecated string_span feature, encouraging users to migrate to std::string_view.

Note: We continue to recommend using gsl::span as a safer alternative tostd::span.

Compatibility Updates

We want to make sure GSL runs well on the latest compilers and modern operating systems. To that end, we have modernized our build infrastructure to validate that GSL is supported by the latest development environments:

More information about our supported platforms can be found in ourREADME.

Bug Fixes and Standards Compliance

Several important bugs have been fixed in this release:

Try It Out

To start using GSL v4.2.0, you can either:

  1. Install via vcpkg: vcpkg install ms-gsl
  2. Download from GitHub:microsoft/GSL

For detailed release notes and migration guidance, please visit ourGitHub repository.

Contributing to GSL

This release would not have been possible without our community contributors. Special thanks to the following individuals for their valuable contributions:

If you wish to contribute to GSL, please refer to our open issues and pull requests in the Microsoft/GSL repository on GitHub. We welcome your feedback and contributions!

Please remember to follow ourCode of Conduct when contributing to GSL.

Feedback

In addition to contributing, we would love to hear your thoughts on the latest updates to GSL! Please share your feedback and suggestions in the comments below.

Author

Carson Radtke

C++ Static Analysis Team | Microsoft/GSL Maintainer