[libcxx-commits] [PATCH] D135292: [libc++][format] Improves CTAD.
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Oct 11 09:27:07 PDT 2022
ldionne accepted this revision.
ldionne added inline comments.
This revision is now accepted and ready to land.
================
Comment at: libcxx/include/__config:1202
// There are a handful of standard library types that are intended to support CTAD but don't need any
// explicit deduction guides to do so. This macro is used to mark them as such, which suppresses the
----------------
================
Comment at: libcxx/include/__config:1206
#if _LIBCPP_STD_VER >= 17
-# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \
- template <class _Tag = void> \
- _ClassName(typename _Tag::__allow_ctad) -> _ClassName<_Tag>
+# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \
+ template <class _Tag = void> \
----------------
ldionne wrote:
> Can we instead try this?
>
> ```
> #define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \
> template <class ..._Tag> \
> _ClassName(typename _Tag::__allow_ctad...) -> _ClassName<_Tag...>;
> ```
>
> Would that allow handling class templates that take any number of arguments?
In a follow-up patch, I think we could consider also renaming this macro to `_LIBCPP_CTAD_INTENDED_TO_WORK`? We can bikeshed on that but I think we can find something better than `_LIBCPP_CTAD_SUPPORTED_FOR_TYPE`.
================
Comment at: libcxx/include/__config:1206-1208
+# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \
+ template <class _Tag = void> \
+ _ClassName(typename _Tag::__allow_ctad)->_ClassName<_Tag>
----------------
Can we instead try this?
```
#define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \
template <class ..._Tag> \
_ClassName(typename _Tag::__allow_ctad...) -> _ClassName<_Tag...>;
```
Would that allow handling class templates that take any number of arguments?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135292/new/
https://reviews.llvm.org/D135292
More information about the libcxx-commits
mailing list