From 5e4463a7c19cca78b949d094f1e364bece769485 Mon Sep 17 00:00:00 2001 From: Jordan Maples Date: Thu, 3 Oct 2019 15:47:25 -0700 Subject: [PATCH] removing function deprecation, adding additional class / struct deprecations --- include/gsl/multi_span | 77 +++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/include/gsl/multi_span b/include/gsl/multi_span index eac4397..4ea5c83 100644 --- a/include/gsl/multi_span +++ b/include/gsl/multi_span @@ -76,18 +76,18 @@ namespace gsl namespace details { template - struct SizeTypeTraits + struct [[deprecated]] SizeTypeTraits { static const SizeType max_value = std::numeric_limits::max(); }; template - class are_integral : public std::integral_constant + class [[deprecated]] are_integral : public std::integral_constant { }; template - class are_integral + class [[deprecated]] are_integral : public std::integral_constant::value && are_integral::value> { @@ -292,7 +292,7 @@ namespace details { template - struct LessThan + struct [[deprecated]] LessThan { static const bool value = Left < Right; }; @@ -551,7 +551,7 @@ namespace details } // namespace details template -class bounds_iterator; +class [[deprecated]] bounds_iterator; template class [[deprecated]] static_bounds { @@ -1067,17 +1067,17 @@ namespace details } // namespace details template -class contiguous_span_iterator; +class [[deprecated]] contiguous_span_iterator; template -class general_span_iterator; +class [[deprecated]] general_span_iterator; template -struct dim_t +struct [[deprecated]] dim_t { static const std::ptrdiff_t value = DimSize; }; template <> -struct dim_t +struct [[deprecated]] dim_t { static const std::ptrdiff_t value = dynamic_range; const std::ptrdiff_t dvalue; @@ -1098,28 +1098,30 @@ constexpr dim_t dim(std::ptrdiff_t n) noexcept template -class multi_span; +class [[deprecated]] multi_span; + template -class strided_span; +class [[deprecated]] strided_span; namespace details { template - struct SpanTypeTraits + struct [[deprecated]] SpanTypeTraits { using value_type = T; using size_type = std::size_t; }; template - struct SpanTypeTraits::type> + struct [[deprecated]] SpanTypeTraits< + Traits, typename std::is_reference::type> { using value_type = typename Traits::span_traits::value_type; using size_type = typename Traits::span_traits::size_type; }; template - struct SpanArrayTraits + struct [[deprecated]] SpanArrayTraits { using type = multi_span; using value_type = T; @@ -1128,7 +1130,7 @@ namespace details using reference = T&; }; template - struct SpanArrayTraits : SpanArrayTraits + struct [[deprecated]] SpanArrayTraits : SpanArrayTraits { }; @@ -1152,7 +1154,7 @@ namespace details totalSize, std::integral_constant()); } - struct Sep + struct [[deprecated]] Sep { }; @@ -1175,29 +1177,29 @@ namespace details } template - struct static_as_multi_span_static_bounds_helper + struct [[deprecated]] static_as_multi_span_static_bounds_helper { using type = static_bounds<(Dimensions::value)...>; }; template - struct is_multi_span_oracle : std::false_type + struct [[deprecated]] is_multi_span_oracle : std::false_type { }; template - struct is_multi_span_oracle> + struct [[deprecated]] is_multi_span_oracle> : std::true_type { }; template - struct is_multi_span_oracle> : std::true_type + struct [[deprecated]] is_multi_span_oracle> : std::true_type { }; template - struct is_multi_span : is_multi_span_oracle> + struct [[deprecated]] is_multi_span : is_multi_span_oracle> { }; } // namespace details @@ -1626,7 +1628,7 @@ public: // DimCount and Enabled here are workarounds for a bug in MSVC 2015 template 0), typename = std::enable_if_t> -[[deprecated]] constexpr auto as_multi_span(SpanType s, Dimensions2... dims) +constexpr auto as_multi_span(SpanType s, Dimensions2... dims) -> multi_span { static_assert(details::is_multi_span::value, @@ -1640,7 +1642,7 @@ template to a multi_span template -[[deprecated]] multi_span +multi_span as_bytes(multi_span s) noexcept { static_assert(std::is_trivial>::value, @@ -1653,7 +1655,7 @@ as_bytes(multi_span s) noexcept // on all implementations. It should be considered an experimental extension // to the standard GSL interface. template -[[deprecated]] multi_span as_writeable_bytes(multi_span s) noexcept +multi_span as_writeable_bytes(multi_span s) noexcept { static_assert(std::is_trivial>::value, "The value_type of multi_span must be a trivial type."); @@ -1665,7 +1667,7 @@ template // on all implementations. It should be considered an experimental extension // to the standard GSL interface. template -[[deprecated]] constexpr auto as_multi_span(multi_span s) -> multi_span< +constexpr auto as_multi_span(multi_span s) -> multi_span< const U, static_cast( multi_span::bounds_type::static_size != dynamic_range ? (static_cast( @@ -1691,7 +1693,7 @@ template // on all implementations. It should be considered an experimental extension // to the standard GSL interface. template -[[deprecated]] constexpr auto as_multi_span(multi_span s) +constexpr auto as_multi_span(multi_span s) -> multi_span( multi_span::bounds_type::static_size != dynamic_range ? static_cast( @@ -1711,7 +1713,7 @@ template } template -[[deprecated]] constexpr auto as_multi_span(T* const& ptr, dim_t... args) +constexpr auto as_multi_span(T* const& ptr, dim_t... args) -> multi_span, Dimensions...> { return {reinterpret_cast*>(ptr), @@ -1720,42 +1722,42 @@ template } template -[[deprecated]] constexpr auto as_multi_span(T* arr, std::ptrdiff_t len) -> +constexpr auto as_multi_span(T* arr, std::ptrdiff_t len) -> typename details::SpanArrayTraits::type { return {reinterpret_cast*>(arr), len}; } template -[[deprecated]] constexpr auto as_multi_span(T (&arr)[N]) -> +constexpr auto as_multi_span(T (&arr)[N]) -> typename details::SpanArrayTraits::type { return {arr}; } template -[[deprecated]] constexpr multi_span as_multi_span(const std::array& arr) +constexpr multi_span as_multi_span(const std::array& arr) { return {arr}; } template -[[deprecated]] constexpr multi_span as_multi_span(const std::array&&) = delete; +constexpr multi_span as_multi_span(const std::array&&) = delete; template -[[deprecated]] constexpr multi_span as_multi_span(std::array& arr) +constexpr multi_span as_multi_span(std::array& arr) { return {arr}; } template -[[deprecated]] constexpr multi_span as_multi_span(T* begin, T* end) +constexpr multi_span as_multi_span(T* begin, T* end) { return {begin, end}; } template -[[deprecated]] constexpr auto as_multi_span(Cont& arr) -> std::enable_if_t< +constexpr auto as_multi_span(Cont& arr) -> std::enable_if_t< !details::is_multi_span>::value, multi_span, dynamic_range>> { @@ -1764,14 +1766,14 @@ template } template -[[deprecated]] constexpr auto as_multi_span(Cont&& arr) -> std::enable_if_t< +constexpr auto as_multi_span(Cont&& arr) -> std::enable_if_t< !details::is_multi_span>::value, multi_span, dynamic_range>> = delete; // from basic_string which doesn't have nonconst .data() member like other contiguous containers template GSL_SUPPRESS(bounds.4) // NO-FORMAT: attribute -[[deprecated]] constexpr auto as_multi_span(std::basic_string& str) +constexpr auto as_multi_span(std::basic_string& str) -> multi_span { Expects(str.size() < PTRDIFF_MAX); @@ -2145,8 +2147,7 @@ contiguous_span_iterator operator+(typename contiguous_span_iterator } template -class [[deprecated( - "This concept is not present in the C++ Core Guidelines")]] general_span_iterator { +class [[deprecated]] general_span_iterator { public: using iterator_category = std::random_access_iterator_tag; using value_type = typename Span::value_type;