/* * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef DISTRIBUTED_POINT_FUNCTIONS_DPF_INTERNAL_ANY_SPAN_H_ #define DISTRIBUTED_POINT_FUNCTIONS_DPF_INTERNAL_ANY_SPAN_H_ // A class that can serve the purpose of both absl::Span<T> and absl::Span<T*> // at the same time. Introduces the run-time overhead of a std::variant check. // // Note that this class DOES NOT provide common container features, such as // iterators. It is not intended to be used by users of this library. Any // function that takes a MaybeDerefSpan<T> should be called with either an // absl::Span<T> or an absl::Span<T*>. #include <type_traits> #include "absl/meta/type_traits.h" #include "absl/types/span.h" #include "absl/types/variant.h" namespace distributed_point_functions { namespace dpf_internal { template <typename T> class MaybeDerefSpan { … }; } // namespace dpf_internal } // namespace distributed_point_functions #endif // DISTRIBUTED_POINT_FUNCTIONS_DPF_INTERNAL_ANY_SPAN_H_