From dc875e505b94733bdc07d10990e54f4af5d3110e Mon Sep 17 00:00:00 2001 From: Denis Yaroshevskiy Date: Mon, 5 Aug 2024 06:40:24 -0700 Subject: [PATCH] folly concepts #1 (#2249) Summary: Pull Request resolved: https://github.com/facebook/folly/pull/2249 We have a need for some common concepts that are used in many places. This is a proposal, please let me know what you think. Usages example: `uncvref_same_as`: https://www.internalfb.com/code/fbsource/[a71ce59323a15fd7559d6132c1f8e2d0256ca7cb]/fbcode/multifeed/entrepot/lib/zdb_manager/ZdbUtil.h?lines=237 `uncvref_instantiated_from`: https://www.internalfb.com/code/fbsource/[b366209d2c108133a0545edc7943b9461323623b]/fbcode/multifeed/mfaction/MFHashSerializer.h?lines=38 Reviewed By: yfeldblum Differential Revision: D59396081 fbshipit-source-id: 4912c2f9fe683f4d3b37fce43466c9281d03ce13 --- folly/Traits.h | 32 ++++++++++++++++++++++++++- folly/test/PortabilityTest.cpp | 4 ---- folly/test/TraitsTest.cpp | 40 ++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 5 deletions(-) diff --git a/folly/Traits.h b/folly/Traits.h index 3c6b86e1301..6ae5c064c49 100644 --- a/folly/Traits.h +++ b/folly/Traits.h @@ -159,9 +159,11 @@ struct is_bounded_array : std::bool_constant> {}; /// is_instantiation_of_v /// is_instantiation_of +/// instantiated_from +/// uncvref_instantiated_from /// /// A trait variable and type to check if a given type is an instantiation of a -/// class template. +/// class template. And corresponding concepts. /// /// Note that this only works with type template parameters. It does not work /// with non-type template parameters, template template parameters, or alias @@ -174,6 +176,17 @@ template