/*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2011-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
using _t = typename T::type;
/**
+ * A type trait to remove all const volatile and reference qualifiers on a
+ * type T
+ */
+template <typename T>
+struct remove_cvref {
+ using type =
+ typename std::remove_cv<typename std::remove_reference<T>::type>::type;
+};
+template <typename T>
+using remove_cvref_t = typename remove_cvref<T>::type;
+
+/**
+ * type_t
+ *
+ * A type alias for the first template type argument. `type_t` is useful for
+ * controlling class-template and function-template partial specialization.
+ *
+ * Example:
+ *
+ * template <typename Value>
+ * class Container {
+ * public:
+ * template <typename... Args>
+ * Container(
+ * type_t<in_place_t, decltype(Value(std::declval<Args>()...))>,
+ * Args&&...);
+ * };
+ *
* void_t
*
* A type alias for `void`. `void_t` is useful for controling class-template
- * partial specialization.
+ * and function-template partial specialization.
*
* Example:
*
*/
namespace traits_detail {
-template <class...>
-struct void_t_ {
- using type = void;
+template <class T, class...>
+struct type_t_ {
+ using type = T;
};
} // namespace traits_detail
+template <class T, class... Ts>
+using type_t = typename traits_detail::type_t_<T, Ts...>::type;
template <class... Ts>
-using void_t = _t<traits_detail::void_t_<Ts...>>;
+using void_t = type_t<void, Ts...>;
/**
* IsRelocatable<T>::value describes the ability of moving around
template <class T>
using is_trivially_copyable = std::is_trivially_copyable<T>;
#endif
-}
+} // namespace traits_detail
struct Ignore {
+ Ignore() = default;
template <class T>
- /* implicit */ Ignore(const T&) {}
+ constexpr /* implicit */ Ignore(const T&) {}
template <class T>
const Ignore& operator=(T const&) const { return *this; }
};
decltype(std::declval<T>() == std::declval<U>()),
bool
> {};
-}
+} // namespace traits_detail_IsEqualityComparable
/* using override */ using traits_detail_IsEqualityComparable::
IsEqualityComparable;
decltype(std::declval<T>() < std::declval<U>()),
bool
> {};
-}
+} // namespace traits_detail_IsLessThanComparable
/* using override */ using traits_detail_IsLessThanComparable::
IsLessThanComparable;
noexcept(swap(std::declval<T&>(), std::declval<T&>()))
> {};
#endif
-}
+} // namespace traits_detail_IsNothrowSwappable
/* using override */ using traits_detail_IsNothrowSwappable::IsNothrowSwappable;