Commit 71927b43 by Abseil Team Committed by Copybara-Service

Replace absl::IsConvertibleHelper with std::is_convertible

PiperOrigin-RevId: 495898835
Change-Id: Id2150a0505020ac2be4487e904d167a26316260c
parent d5240fc5
......@@ -99,28 +99,9 @@ bool LessThanImpl(SpanT<T> a, SpanT<T> b) {
return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end());
}
// The `IsConvertible` classes here are needed because of the
// `std::is_convertible` bug in libcxx when compiled with GCC. This build
// configuration is used by Android NDK toolchain. Reference link:
// https://bugs.llvm.org/show_bug.cgi?id=27538.
template <typename From, typename To>
struct IsConvertibleHelper {
private:
static std::true_type testval(To);
static std::false_type testval(...);
public:
using type = decltype(testval(std::declval<From>()));
};
template <typename From, typename To>
struct IsConvertible : IsConvertibleHelper<From, To>::type {};
// TODO(zhangxy): replace `IsConvertible` with `std::is_convertible` once the
// older version of libcxx is not supported.
template <typename From, typename To>
using EnableIfConvertibleTo =
typename std::enable_if<IsConvertible<From, To>::value>::type;
typename std::enable_if<std::is_convertible<From, To>::value>::type;
// IsView is true for types where the return type of .data() is the same for
// mutable and const instances. This isn't foolproof, but it's only used to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment