Skip to content

Commit

Permalink
Replace Not with folly::Negation in PolyDetail.h (facebook#1045)
Browse files Browse the repository at this point in the history
Summary:
- Replace `Not` template alias from `PolyDetail.h` with `folly::Negation` from
 `folly/Traits.h` which does the same thing.
Pull Request resolved: facebook#1045

Reviewed By: ericniebler

Differential Revision: D14402105

Pulled By: yfeldblum

fbshipit-source-id: 100347dbdc159c5217c7452b202650d58d80850c
  • Loading branch information
JoeLoser authored and facebook-github-bot committed Mar 12, 2019
1 parent ac744ab commit f52d7dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
6 changes: 2 additions & 4 deletions folly/Poly.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,13 @@ constexpr bool poly_empty(Poly<I&> const&) noexcept {
*/
template <
class I,
std::enable_if_t<detail::Not<std::is_reference<I>>::value, int> = 0>
std::enable_if_t<Negation<std::is_reference<I>>::value, int> = 0>
constexpr Poly<I>&& poly_move(detail::PolyRoot<I>& that) noexcept {
return static_cast<Poly<I>&&>(static_cast<Poly<I>&>(that));
}

/// \overload
template <
class I,
std::enable_if_t<detail::Not<std::is_const<I>>::value, int> = 0>
template <class I, std::enable_if_t<Negation<std::is_const<I>>::value, int> = 0>
Poly<I&&> poly_move(detail::PolyRoot<I&> const& that) noexcept {
return detail::PolyAccess::move(that);
}
Expand Down
7 changes: 2 additions & 5 deletions folly/detail/PolyDetail.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@ struct IsInstanceOf : std::false_type {};
template <class... Ts, template <class...> class U>
struct IsInstanceOf<U<Ts...>, U> : std::true_type {};

template <class T>
using Not = Bool<!T::value>;

template <class Then>
decltype(auto) if_constexpr(std::true_type, Then then) {
return then(Identity{});
Expand Down Expand Up @@ -601,7 +598,7 @@ void* execOnHeap(Op op, Data* from, void* to) {
template <
class I,
class T,
std::enable_if_t<Not<std::is_reference<T>>::value, int> = 0>
std::enable_if_t<Negation<std::is_reference<T>>::value, int> = 0>
void* execOnHeap(Op op, Data* from, void* to) {
switch (op) {
case Op::eNuke:
Expand Down Expand Up @@ -901,7 +898,7 @@ template <
class T,
class I,
class U = std::decay_t<T>,
std::enable_if_t<Not<std::is_base_of<PolyBase, U>>::value, int> = 0,
std::enable_if_t<Negation<std::is_base_of<PolyBase, U>>::value, int> = 0,
std::enable_if_t<std::is_constructible<AddCvrefOf<U, I>, T>::value, int> =
0,
class = MembersOf<std::decay_t<I>, U>>
Expand Down

0 comments on commit f52d7dc

Please sign in to comment.