diff --git a/include/openssl/span.h b/include/openssl/span.h index 4f11559e7..a6cd5b7a1 100644 --- a/include/openssl/span.h +++ b/include/openssl/span.h @@ -30,6 +30,28 @@ extern "C++" { #include #endif +#if defined(__has_include) +#if __has_include() +#include +#endif +#endif + +#if defined(__cpp_lib_ranges) && __cpp_lib_ranges >= 201911L +#include +BSSL_NAMESPACE_BEGIN +template +class Span; +BSSL_NAMESPACE_END + +// Mark `Span` as satisfying the `view` and `borrowed_range` concepts. This +// should be done before the definition of `Span`, so that any inlined calls to +// range functionality use the correct specializations. +template +inline constexpr bool std::ranges::enable_view> = true; +template +inline constexpr bool std::ranges::enable_borrowed_range> = true; +#endif + BSSL_NAMESPACE_BEGIN template diff --git a/pki/input.h b/pki/input.h index 6ed79d9e0..15bdbd62e 100644 --- a/pki/input.h +++ b/pki/input.h @@ -14,6 +14,28 @@ #include #include +#if defined(__has_include) +#if __has_include() +#include +#endif +#endif + +#if defined(__cpp_lib_ranges) && __cpp_lib_ranges >= 201911L +#include +namespace bssl::der { +class OPENSSL_EXPORT Input; +} + +// Mark `Input` as satisfying the `view` and `borrowed_range` concepts. This +// should be done before the definition of `Input`, so that any inlined calls to +// range functionality use the correct specializations. +template <> +inline constexpr bool std::ranges::enable_view = true; +template <> +inline constexpr bool std::ranges::enable_borrowed_range = + true; +#endif + namespace bssl::der { // An opaque class that represents a fixed buffer of data of a fixed length,