Commit 9ff87c20 authored by Joe Loser's avatar Joe Loser Committed by Facebook Github Bot

Replace Uncvref with remove_cvref_t in PolyDetail.h (#1047)

Summary:
- Replace `Uncvref` alias template with `folly::remove_cvref_t` from
  `folly/Traits.h` which does the same thing.
Pull Request resolved: https://github.com/facebook/folly/pull/1047

Reviewed By: Orvid

Differential Revision: D14395552

Pulled By: yfeldblum

fbshipit-source-id: 10ac4fbadbd20876fda4957f9a85454ad6c8a994
parent 26eb3a19
...@@ -181,9 +181,6 @@ itself, depending on the size of T and whether or not it has a noexcept move ...@@ -181,9 +181,6 @@ itself, depending on the size of T and whether or not it has a noexcept move
constructor. constructor.
*/ */
template <class T>
using Uncvref = std::remove_cv_t<std::remove_reference_t<T>>;
template <class T, template <class...> class U> template <class T, template <class...> class U>
struct IsInstanceOf : std::false_type {}; struct IsInstanceOf : std::false_type {};
...@@ -226,13 +223,13 @@ struct PolyRef; ...@@ -226,13 +223,13 @@ struct PolyRef;
struct PolyAccess; struct PolyAccess;
template <class T> template <class T>
using IsPoly = IsInstanceOf<Uncvref<T>, Poly>; using IsPoly = IsInstanceOf<remove_cvref_t<T>, Poly>;
// Given an interface I and a concrete type T that satisfies the interface // Given an interface I and a concrete type T that satisfies the interface
// I, create a list of member function bindings from members of T to members // I, create a list of member function bindings from members of T to members
// of I. // of I.
template <class I, class T> template <class I, class T>
using MembersOf = typename I::template Members<Uncvref<T>>; using MembersOf = typename I::template Members<remove_cvref_t<T>>;
// Given an interface I and a base type T, create a type that implements // Given an interface I and a base type T, create a type that implements
// the interface I in terms of the capabilities of T. // the interface I in terms of the capabilities of T.
...@@ -380,13 +377,13 @@ struct Data { ...@@ -380,13 +377,13 @@ struct Data {
template <class U, class I> template <class U, class I>
using Arg = using Arg =
If<std::is_same<Uncvref<U>, Archetype<I>>::value, If<std::is_same<remove_cvref_t<U>, Archetype<I>>::value,
Poly<AddCvrefOf<I, U const&>>, Poly<AddCvrefOf<I, U const&>>,
U>; U>;
template <class U, class I> template <class U, class I>
using Ret = using Ret =
If<std::is_same<Uncvref<U>, Archetype<I>>::value, If<std::is_same<remove_cvref_t<U>, Archetype<I>>::value,
AddCvrefOf<Poly<I>, U>, AddCvrefOf<Poly<I>, U>,
U>; U>;
...@@ -483,10 +480,10 @@ template <class Arg, class U> ...@@ -483,10 +480,10 @@ template <class Arg, class U>
decltype(auto) convert(U&& u) { decltype(auto) convert(U&& u) {
return detail::if_constexpr( return detail::if_constexpr(
StrictConjunction< StrictConjunction<
IsPolyRef<Uncvref<U>>, IsPolyRef<remove_cvref_t<U>>,
Negation<std::is_convertible<U, Arg>>>(), Negation<std::is_convertible<U, Arg>>>(),
[&](auto id) -> decltype(auto) { [&](auto id) -> decltype(auto) {
return poly_cast<Uncvref<Arg>>(id(u).get()); return poly_cast<remove_cvref_t<Arg>>(id(u).get());
}, },
[&](auto id) -> U&& { return static_cast<U&&>(id(u)); }); [&](auto id) -> U&& { return static_cast<U&&>(id(u)); });
} }
...@@ -595,7 +592,7 @@ void* execOnHeap(Op op, Data* from, void* to) { ...@@ -595,7 +592,7 @@ void* execOnHeap(Op op, Data* from, void* to) {
} }
throw_exception<BadPolyCast>(); throw_exception<BadPolyCast>();
case Op::eRefr: case Op::eRefr:
return vtableForRef<I, Uncvref<T>>( return vtableForRef<I, remove_cvref_t<T>>(
static_cast<RefType>(reinterpret_cast<std::uintptr_t>(to))); static_cast<RefType>(reinterpret_cast<std::uintptr_t>(to)));
} }
return nullptr; return nullptr;
...@@ -626,7 +623,7 @@ void* execOnHeap(Op op, Data* from, void* to) { ...@@ -626,7 +623,7 @@ void* execOnHeap(Op op, Data* from, void* to) {
} }
throw_exception<BadPolyCast>(); throw_exception<BadPolyCast>();
case Op::eRefr: case Op::eRefr:
return vtableForRef<I, Uncvref<T>>( return vtableForRef<I, remove_cvref_t<T>>(
static_cast<RefType>(reinterpret_cast<std::uintptr_t>(to))); static_cast<RefType>(reinterpret_cast<std::uintptr_t>(to)));
} }
return nullptr; return nullptr;
...@@ -657,7 +654,7 @@ void* execInSitu(Op op, Data* from, void* to) { ...@@ -657,7 +654,7 @@ void* execInSitu(Op op, Data* from, void* to) {
} }
throw_exception<BadPolyCast>(); throw_exception<BadPolyCast>();
case Op::eRefr: case Op::eRefr:
return vtableForRef<I, Uncvref<T>>( return vtableForRef<I, remove_cvref_t<T>>(
static_cast<RefType>(reinterpret_cast<std::uintptr_t>(to))); static_cast<RefType>(reinterpret_cast<std::uintptr_t>(to)));
} }
return nullptr; return nullptr;
...@@ -736,10 +733,10 @@ struct PolyAccess { ...@@ -736,10 +733,10 @@ struct PolyAccess {
} }
template <class Poly> template <class Poly>
using Iface = typename Uncvref<Poly>::_polyInterface_; using Iface = typename remove_cvref_t<Poly>::_polyInterface_;
template <class Node, class Tfx = MetaIdentity> template <class Node, class Tfx = MetaIdentity>
static typename Uncvref<Node>::template _polySelf_<Node, Tfx> self_(); static typename remove_cvref_t<Node>::template _polySelf_<Node, Tfx> self_();
template <class T, class Poly, class I = Iface<Poly>> template <class T, class Poly, class I = Iface<Poly>>
static decltype(auto) cast(Poly&& _this) { static decltype(auto) cast(Poly&& _this) {
...@@ -763,7 +760,8 @@ struct PolyAccess { ...@@ -763,7 +760,8 @@ struct PolyAccess {
} }
template <class I> template <class I>
static VTable<Uncvref<I>> const* vtable(PolyRoot<I> const& _this) noexcept { static VTable<remove_cvref_t<I>> const* vtable(
PolyRoot<I> const& _this) noexcept {
return _this.vptr_; return _this.vptr_;
} }
...@@ -832,8 +830,10 @@ struct PolyRoot : private PolyBase, private Data { ...@@ -832,8 +830,10 @@ struct PolyRoot : private PolyBase, private Data {
}; };
template <class I> template <class I>
using PolyImpl = using PolyImpl = TypeFold<
TypeFold<InclusiveSubsumptionsOf<Uncvref<I>>, PolyRoot<I>, MakePolyNode>; InclusiveSubsumptionsOf<remove_cvref_t<I>>,
PolyRoot<I>,
MakePolyNode>;
// A const-qualified function type means the user is trying to disambiguate // A const-qualified function type means the user is trying to disambiguate
// a member function pointer. // a member function pointer.
......
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