X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;ds=sidebyside;f=folly%2FTraits.h;h=fb797f377bb72a7f860180c8ea511066c15ce0c5;hb=6ae2206d4a23d683877e33919a469abfdfc411e5;hp=d1ab157a4d4e2494a6eb0349356b86c73a390d8e;hpb=f2925b23df8d85ebca72d62a69f1282528c086de;p=folly.git diff --git a/folly/Traits.h b/folly/Traits.h index d1ab157a..fb797f37 100644 --- a/folly/Traits.h +++ b/folly/Traits.h @@ -156,10 +156,26 @@ template using _t = typename 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 + * class Container { + * public: + * template + * Container( + * type_t()...))>, + * Args&&...); + * }; + * * void_t * * A type alias for `void`. `void_t` is useful for controling class-template - * partial specialization. + * and function-template partial specialization. * * Example: * @@ -204,14 +220,16 @@ using _t = typename T::type; */ namespace traits_detail { -template -struct void_t_ { - using type = void; +template +struct type_t_ { + using type = T; }; } // namespace traits_detail +template +using type_t = typename traits_detail::type_t_::type; template -using void_t = _t>; +using void_t = type_t; /** * IsRelocatable::value describes the ability of moving around @@ -293,8 +311,9 @@ using is_trivially_copyable = std::is_trivially_copyable; } // namespace traits_detail struct Ignore { + Ignore() = default; template - /* implicit */ Ignore(const T&) {} + constexpr /* implicit */ Ignore(const T&) {} template const Ignore& operator=(T const&) const { return *this; } };