Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:41:02

0001 // Copyright 2023 The Abseil Authors
0002 //
0003 // Licensed under the Apache License, Version 2.0 (the "License");
0004 // you may not use this file except in compliance with the License.
0005 // You may obtain a copy of the License at
0006 //
0007 //     https://www.apache.org/licenses/LICENSE-2.0
0008 //
0009 // Unless required by applicable law or agreed to in writing, software
0010 // distributed under the License is distributed on an "AS IS" BASIS,
0011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0012 // See the License for the specific language governing permissions and
0013 // limitations under the License.
0014 
0015 #ifndef ABSL_STRINGS_HAS_OSTREAM_OPERATOR_H_
0016 #define ABSL_STRINGS_HAS_OSTREAM_OPERATOR_H_
0017 
0018 #include <ostream>
0019 #include <type_traits>
0020 #include <utility>
0021 
0022 #include "absl/base/config.h"
0023 
0024 namespace absl {
0025 ABSL_NAMESPACE_BEGIN
0026 
0027 // Detects if type `T` supports streaming to `std::ostream`s with `operator<<`.
0028 
0029 template <typename T, typename = void>
0030 struct HasOstreamOperator : std::false_type {};
0031 
0032 template <typename T>
0033 struct HasOstreamOperator<
0034     T, std::enable_if_t<std::is_same<
0035            std::ostream&, decltype(std::declval<std::ostream&>()
0036                                    << std::declval<const T&>())>::value>>
0037     : std::true_type {};
0038 
0039 ABSL_NAMESPACE_END
0040 }  // namespace absl
0041 
0042 #endif  // ABSL_STRINGS_HAS_OSTREAM_OPERATOR_H_