|
28 | 28 | #include <__type_traits/add_pointer.h> |
29 | 29 | #include <__type_traits/is_const.h> |
30 | 30 | #include <__type_traits/is_volatile.h> |
| 31 | +#include <__type_traits/is_class.h> |
| 32 | +#include <__type_traits/is_union.h> |
31 | 33 | #include <__type_traits/type_identity.h> |
32 | 34 | #include <__utility/declval.h> |
33 | 35 | #include <__utility/forward.h> |
@@ -81,7 +83,7 @@ template <class _Container, input_range _Range, class... _Args> |
81 | 83 | static_assert(!is_const_v<_Container>, "The target container cannot be const-qualified, please remove the const"); |
82 | 84 | static_assert( |
83 | 85 | !is_volatile_v<_Container>, "The target container cannot be volatile-qualified, please remove the volatile"); |
84 | | - |
| 86 | + static_assert(is_class_v<_Container>||is_union_v<_Container>, "The target must be a class type"); |
85 | 87 | // First see if the non-recursive case applies -- the conversion target is either: |
86 | 88 | // - a range with a convertible value type; |
87 | 89 | // - a non-range type which might support being created from the input argument(s) (e.g. an `optional`). |
@@ -208,7 +210,7 @@ template <class _Container, class... _Args> |
208 | 210 | static_assert(!is_const_v<_Container>, "The target container cannot be const-qualified, please remove the const"); |
209 | 211 | static_assert( |
210 | 212 | !is_volatile_v<_Container>, "The target container cannot be volatile-qualified, please remove the volatile"); |
211 | | - |
| 213 | + static_assert(is_class_v<_Container>||is_union_v<_Container>, "The target must be a class type"); |
212 | 214 | auto __to_func = []<input_range _Range, class... _Tail>(_Range&& __range, _Tail&&... __tail) static |
213 | 215 | requires requires { // |
214 | 216 | /**/ ranges::to<_Container>(std::forward<_Range>(__range), std::forward<_Tail>(__tail)...); |
|
0 commit comments