Commit d277a48d by Copybara-Service

Merge pull request #1284 from t0ny-peng:chore/remove-unused-class-in-variant

PiperOrigin-RevId: 478500346
Change-Id: Ia15746857db3068ca74e95a447c5cc26f9450d94
parents 6acb60c1 98f9a611
...@@ -449,7 +449,7 @@ struct FlattenIndices; ...@@ -449,7 +449,7 @@ struct FlattenIndices;
template <std::size_t HeadSize, std::size_t... TailSize> template <std::size_t HeadSize, std::size_t... TailSize>
struct FlattenIndices<HeadSize, TailSize...> { struct FlattenIndices<HeadSize, TailSize...> {
template<class... SizeType> template <class... SizeType>
static constexpr std::size_t Run(std::size_t head, SizeType... tail) { static constexpr std::size_t Run(std::size_t head, SizeType... tail) {
return head + HeadSize * FlattenIndices<TailSize...>::Run(tail...); return head + HeadSize * FlattenIndices<TailSize...>::Run(tail...);
} }
...@@ -498,8 +498,8 @@ struct VisitIndicesVariadicImpl<absl::index_sequence<N...>, EndIndices...> { ...@@ -498,8 +498,8 @@ struct VisitIndicesVariadicImpl<absl::index_sequence<N...>, EndIndices...> {
}; };
template <class Op, class... SizeType> template <class Op, class... SizeType>
static VisitIndicesResultT<Op, decltype(EndIndices)...> Run( static VisitIndicesResultT<Op, decltype(EndIndices)...> Run(Op&& op,
Op&& op, SizeType... i) { SizeType... i) {
return VisitIndicesSwitch<NumCasesOfSwitch<EndIndices...>::value>::Run( return VisitIndicesSwitch<NumCasesOfSwitch<EndIndices...>::value>::Run(
FlattenedOp<Op>{absl::forward<Op>(op)}, FlattenedOp<Op>{absl::forward<Op>(op)},
FlattenIndices<(EndIndices + std::size_t{1})...>::Run( FlattenIndices<(EndIndices + std::size_t{1})...>::Run(
...@@ -868,18 +868,6 @@ struct IsNeitherSelfNorInPlace<Self, in_place_type_t<T>> : std::false_type {}; ...@@ -868,18 +868,6 @@ struct IsNeitherSelfNorInPlace<Self, in_place_type_t<T>> : std::false_type {};
template <class Self, std::size_t I> template <class Self, std::size_t I>
struct IsNeitherSelfNorInPlace<Self, in_place_index_t<I>> : std::false_type {}; struct IsNeitherSelfNorInPlace<Self, in_place_index_t<I>> : std::false_type {};
template <class Variant, class T, class = void>
struct ConversionIsPossibleImpl : std::false_type {};
template <class Variant, class T>
struct ConversionIsPossibleImpl<
Variant, T,
void_t<decltype(ImaginaryFun<Variant>::Run(std::declval<T>(), {}))>>
: std::true_type {};
template <class Variant, class T>
struct ConversionIsPossible : ConversionIsPossibleImpl<Variant, T>::type {};
template <class Variant, class T> template <class Variant, class T>
struct IndexOfConstructedType< struct IndexOfConstructedType<
Variant, T, Variant, T,
...@@ -1151,16 +1139,16 @@ struct VariantHelper<variant<Ts...>> { ...@@ -1151,16 +1139,16 @@ struct VariantHelper<variant<Ts...>> {
// Type metafunction which returns the element type selected if // Type metafunction which returns the element type selected if
// OverloadSet::Overload() is well-formed when called with argument type U. // OverloadSet::Overload() is well-formed when called with argument type U.
template <typename U> template <typename U>
using BestMatch = decltype( using BestMatch = decltype(variant_internal::OverloadSet<Ts...>::Overload(
variant_internal::OverloadSet<Ts...>::Overload(std::declval<U>())); std::declval<U>()));
// Type metafunction which returns true if OverloadSet::Overload() is // Type metafunction which returns true if OverloadSet::Overload() is
// well-formed when called with argument type U. // well-formed when called with argument type U.
// CanAccept can't be just an alias because there is a MSVC bug on parameter // CanAccept can't be just an alias because there is a MSVC bug on parameter
// pack expansion involving decltype. // pack expansion involving decltype.
template <typename U> template <typename U>
struct CanAccept : struct CanAccept
std::integral_constant<bool, !std::is_void<BestMatch<U>>::value> {}; : std::integral_constant<bool, !std::is_void<BestMatch<U>>::value> {};
// Type metafunction which returns true if Other is an instantiation of // Type metafunction which returns true if Other is an instantiation of
// variant, and variants's converting constructor from Other will be // variant, and variants's converting constructor from Other will be
...@@ -1183,8 +1171,8 @@ struct TrivialMoveOnly { ...@@ -1183,8 +1171,8 @@ struct TrivialMoveOnly {
// A union's defaulted copy/move constructor is deleted if any variant member's // A union's defaulted copy/move constructor is deleted if any variant member's
// copy/move constructor is nontrivial. // copy/move constructor is nontrivial.
template <typename T> template <typename T>
struct IsTriviallyMoveConstructible: struct IsTriviallyMoveConstructible
std::is_move_constructible<Union<T, TrivialMoveOnly>> {}; : std::is_move_constructible<Union<T, TrivialMoveOnly>> {};
// To guarantee triviality of all special-member functions that can be trivial, // To guarantee triviality of all special-member functions that can be trivial,
// we use a chain of conditional bases for each one. // we use a chain of conditional bases for each one.
......
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