@@ -33,6 +33,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3333
3434namespace xyz {
3535
36+ #ifndef XYZ_TYPE_IDENTITY_DEFINED
37+ #define XYZ_TYPE_IDENTITY_DEFINED
38+ #ifdef XYZ_HAS_STD_TYPE_IDENTITY
39+ using std::type_identity_t ;
40+ #else
41+ template <class T >
42+ struct type_identity {
43+ using type = T;
44+ };
45+ template <class T >
46+ using type_identity_t = typename type_identity<T>::type;
47+ #endif // XYZ_HAS_STD_TYPE_IDENTITY
48+ #endif // XYZ_TYPE_IDENTITY_DEFINED
49+
3650#ifndef XYZ_UNREACHABLE_DEFINED
3751#define XYZ_UNREACHABLE_DEFINED
3852
@@ -119,12 +133,6 @@ class direct_control_block final : public control_block<T, A> {
119133template <class T , class A >
120134class polymorphic ;
121135
122- template <class >
123- inline constexpr bool is_polymorphic_v = false ;
124-
125- template <class T , class A >
126- inline constexpr bool is_polymorphic_v<polymorphic<T, A>> = true ;
127-
128136template <class T , class A = std::allocator<T>>
129137class polymorphic {
130138 using cblock_t = detail::control_block<T, A>;
@@ -251,7 +259,7 @@ class polymorphic {
251259 }
252260
253261 constexpr polymorphic (std::allocator_arg_t ,
254- const std ::type_identity_t <A>& alloc,
262+ const xyz ::type_identity_t <A>& alloc,
255263 const polymorphic& other)
256264 : alloc_(alloc) {
257265 if (!other.valueless_after_move ()) {
@@ -262,7 +270,7 @@ class polymorphic {
262270 }
263271
264272 constexpr polymorphic (
265- std::allocator_arg_t , const std ::type_identity_t <A>& alloc,
273+ std::allocator_arg_t , const xyz ::type_identity_t <A>& alloc,
266274 polymorphic&& other) noexcept (allocator_traits::is_always_equal::value)
267275 : alloc_(alloc) {
268276 if constexpr (allocator_traits::is_always_equal::value) {
@@ -414,19 +422,17 @@ class polymorphic {
414422 }
415423 }
416424};
417- # ifdef XYZ_HAS_EXTENDED_CONSTRUCTOR_TEMPLATE_ARGUMENT_DEDUCTION
425+
418426template <typename Value>
419427polymorphic (Value) -> polymorphic<Value>;
420428
421- template <typename Alloc, typename Value,
422- typename std::enable_if_t <!is_polymorphic_v<Value>, int > = 0 >
423- polymorphic (std::allocator_arg_t , Alloc, Value) -> polymorphic<
424- Value, typename std::allocator_traits<Alloc>::template rebind_alloc<Value>>;
425-
426429template <typename Alloc, typename Value>
427- polymorphic (std::allocator_arg_t , std::type_identity_t <Alloc>,
428- polymorphic<Value, Alloc>) -> polymorphic<Value, Alloc>;
429- #endif // XYZ_HAS_EXTENDED_CONSTRUCTOR_TEMPLATE_ARGUMENT_DEDUCTION
430+ polymorphic (std::allocator_arg_t , Alloc, Value) -> polymorphic<Value, Alloc>;
431+
432+ template <typename Alloc, typename Alloc2, typename Value>
433+ polymorphic (std::allocator_arg_t , Alloc2, polymorphic<Value, Alloc>)
434+ -> polymorphic<Value, Alloc>;
435+
430436} // namespace xyz
431437
432438#endif // XYZ_POLYMORPHIC_H_
0 commit comments