Commit c3c6b788 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

spell small-vector uses of the trait as is_tivially_copyable_v

Summary: The `folly::` prefix is not necessary from within folly's namespace and the `_v` is available on the folly trait even in C++14 builds when `std::is_trivially_copyable_v` from C++17 is unavailable.

Reviewed By: ot

Differential Revision: D29925029

fbshipit-source-id: 570d17c57ca68bea1c7c8b80ce59d8560b1aba2b
parent 2f5a71dd
...@@ -109,7 +109,7 @@ namespace detail { ...@@ -109,7 +109,7 @@ namespace detail {
* extra copies and moves for non-trivial types. * extra copies and moves for non-trivial types.
*/ */
template <class T, class Create> template <class T, class Create>
typename std::enable_if<!folly::is_trivially_copyable<T>::value>::type typename std::enable_if<!is_trivially_copyable_v<T>>::type
moveObjectsRightAndCreate( moveObjectsRightAndCreate(
T* const first, T* const first,
T* const lastConstructed, T* const lastConstructed,
...@@ -165,7 +165,7 @@ moveObjectsRightAndCreate( ...@@ -165,7 +165,7 @@ moveObjectsRightAndCreate(
// memory may be uninitialized, and std::move_backward() won't work when it // memory may be uninitialized, and std::move_backward() won't work when it
// can't memmove(). // can't memmove().
template <class T, class Create> template <class T, class Create>
typename std::enable_if<folly::is_trivially_copyable<T>::value>::type typename std::enable_if<is_trivially_copyable_v<T>>::type
moveObjectsRightAndCreate( moveObjectsRightAndCreate(
T* const first, T* const first,
T* const lastConstructed, T* const lastConstructed,
...@@ -297,7 +297,7 @@ struct IntegralSizePolicy<SizeType, true> ...@@ -297,7 +297,7 @@ struct IntegralSizePolicy<SizeType, true>
* ranges don't overlap. * ranges don't overlap.
*/ */
template <class T> template <class T>
typename std::enable_if<!folly::is_trivially_copyable<T>::value>::type typename std::enable_if<!is_trivially_copyable_v<T>>::type
moveToUninitialized(T* first, T* last, T* out) { moveToUninitialized(T* first, T* last, T* out) {
std::size_t idx = 0; std::size_t idx = 0;
{ {
...@@ -320,8 +320,8 @@ struct IntegralSizePolicy<SizeType, true> ...@@ -320,8 +320,8 @@ struct IntegralSizePolicy<SizeType, true>
// Specialization for trivially copyable types. // Specialization for trivially copyable types.
template <class T> template <class T>
typename std::enable_if<folly::is_trivially_copyable<T>::value>::type typename std::enable_if<is_trivially_copyable_v<T>>::type moveToUninitialized(
moveToUninitialized(T* first, T* last, T* out) { T* first, T* last, T* out) {
std::memmove( std::memmove(
static_cast<void*>(out), static_cast<void*>(out),
static_cast<void const*>(first), static_cast<void const*>(first),
...@@ -1029,8 +1029,8 @@ class small_vector : public detail::small_vector_base< ...@@ -1029,8 +1029,8 @@ class small_vector : public detail::small_vector_base<
} }
template <class T> template <class T>
typename std::enable_if<folly::is_trivially_copyable<T>::value>::type typename std::enable_if<is_trivially_copyable_v<T>>::type copyInlineTrivial(
copyInlineTrivial(small_vector const& o) { small_vector const& o) {
// Copy the entire inline storage, instead of just size() values, to make // Copy the entire inline storage, instead of just size() values, to make
// the loop fixed-size and unrollable. // the loop fixed-size and unrollable.
std::copy(o.u.buffer(), o.u.buffer() + MaxInline, u.buffer()); std::copy(o.u.buffer(), o.u.buffer() + MaxInline, u.buffer());
...@@ -1038,8 +1038,8 @@ class small_vector : public detail::small_vector_base< ...@@ -1038,8 +1038,8 @@ class small_vector : public detail::small_vector_base<
} }
template <class T> template <class T>
typename std::enable_if<!folly::is_trivially_copyable<T>::value>::type typename std::enable_if<!is_trivially_copyable_v<T>>::type copyInlineTrivial(
copyInlineTrivial(small_vector const&) { small_vector const&) {
assume_unreachable(); assume_unreachable();
} }
...@@ -1284,7 +1284,7 @@ class small_vector : public detail::small_vector_base< ...@@ -1284,7 +1284,7 @@ class small_vector : public detail::small_vector_base<
// it entirely. Limit is half of a cache line, to minimize probability of // it entirely. Limit is half of a cache line, to minimize probability of
// introducing a cache miss. // introducing a cache miss.
static constexpr bool kShouldCopyInlineTrivial = static constexpr bool kShouldCopyInlineTrivial =
folly::is_trivially_copyable<Value>::value && is_trivially_copyable_v<Value> &&
sizeof(InlineStorageType) <= hardware_constructive_interference_size / 2; sizeof(InlineStorageType) <= hardware_constructive_interference_size / 2;
static bool constexpr kHasInlineCapacity = static bool constexpr kHasInlineCapacity =
......
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