diff --git a/FWCore/Utilities/interface/propagate_const_array.h b/FWCore/Utilities/interface/propagate_const_array.h index 3ea630b3781ba..a81d99d151c17 100644 --- a/FWCore/Utilities/interface/propagate_const_array.h +++ b/FWCore/Utilities/interface/propagate_const_array.h @@ -18,18 +18,10 @@ // forward declarations namespace edm { - namespace impl { - // check if a type T has a subscript operator T[N] - template - struct has_subscript_operator : std::false_type {}; - - template - struct has_subscript_operator()[0])>> : std::true_type {}; - template - constexpr auto has_subscript_operator_v = has_subscript_operator::value; + concept ArrayAddressable = requires(T& a) { a[0]; } or std::is_array_v; // for a type T, return the type of the return value of the subscript operator T[N] template @@ -48,7 +40,11 @@ namespace edm { // for non-array types that implement the subscript operator[], a complete type is needed template - struct subscript_type>, std::enable_if_t>> { + requires requires { + requires not std::is_array_v; + requires ArrayAddressable; + } + struct subscript_type { using type = typename std::remove_reference()[0])>::type; }; @@ -57,7 +53,7 @@ namespace edm { } // namespace impl - template + template class propagate_const_array; template @@ -65,13 +61,13 @@ namespace edm { template constexpr std::decay_t const& get_underlying(propagate_const_array const&); - template + template class propagate_const_array { public: friend constexpr std::decay_t& get_underlying(propagate_const_array&); friend constexpr std::decay_t const& get_underlying(propagate_const_array const&); - template + template friend class propagate_const_array; using element_type = typename impl::subscript_type_t;