@@ -33,6 +33,18 @@ 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 { using type = T; };
43+ template <class T >
44+ using type_identity_t = typename type_identity<T>::type;
45+ #endif // XYZ_HAS_STD_TYPE_IDENTITY
46+ #endif // XYZ_TYPE_IDENTITY_DEFINED
47+
3648#ifndef XYZ_UNREACHABLE_DEFINED
3749#define XYZ_UNREACHABLE_DEFINED
3850
@@ -119,12 +131,6 @@ class direct_control_block final : public control_block<T, A> {
119131template <class T , class A >
120132class polymorphic ;
121133
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-
128134template <class T , class A = std::allocator<T>>
129135class polymorphic {
130136 using cblock_t = detail::control_block<T, A>;
@@ -251,7 +257,7 @@ class polymorphic {
251257 }
252258
253259 constexpr polymorphic (std::allocator_arg_t ,
254- const std ::type_identity_t <A>& alloc,
260+ const xyz ::type_identity_t <A>& alloc,
255261 const polymorphic& other)
256262 : alloc_(alloc) {
257263 if (!other.valueless_after_move ()) {
@@ -262,7 +268,7 @@ class polymorphic {
262268 }
263269
264270 constexpr polymorphic (
265- std::allocator_arg_t , const std ::type_identity_t <A>& alloc,
271+ std::allocator_arg_t , const xyz ::type_identity_t <A>& alloc,
266272 polymorphic&& other) noexcept (allocator_traits::is_always_equal::value)
267273 : alloc_(alloc) {
268274 if constexpr (allocator_traits::is_always_equal::value) {
@@ -414,19 +420,17 @@ class polymorphic {
414420 }
415421 }
416422};
417- # ifdef XYZ_HAS_EXTENDED_CONSTRUCTOR_TEMPLATE_ARGUMENT_DEDUCTION
423+
418424template <typename Value>
419425polymorphic (Value) -> polymorphic<Value>;
420426
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-
426427template <typename Alloc, typename Value>
427- polymorphic (std::allocator_arg_t , std::type_identity_t <Alloc>,
428+ polymorphic (std::allocator_arg_t , Alloc, Value) -> polymorphic<Value, Alloc>;
429+
430+ template <typename Alloc, typename Alloc2, typename Value>
431+ polymorphic (std::allocator_arg_t , Alloc2,
428432 polymorphic<Value, Alloc>) -> polymorphic<Value, Alloc>;
429- # endif // XYZ_HAS_EXTENDED_CONSTRUCTOR_TEMPLATE_ARGUMENT_DEDUCTION
433+
430434} // namespace xyz
431435
432436#endif // XYZ_POLYMORPHIC_H_
0 commit comments