[polymorphic.syn]

# 20 Memory management library [[mem]](./#mem)

## 20.4 Types for composite class design [[mem.composite.types]](mem.composite.types#polymorphic.syn)

### 20.4.2 Class template polymorphic [[polymorphic]](polymorphic#syn)

#### 20.4.2.2 Synopsis [polymorphic.syn]

[ð](#lib:polymorphic)

namespace std {template<class T, class Allocator = allocator<T>>class polymorphic {public:using value_type = T; using allocator_type = Allocator; using pointer = typename allocator_traits<Allocator>::pointer; using const_pointer = typename allocator_traits<Allocator>::const_pointer; // [[polymorphic.ctor]](polymorphic.ctor "20.4.2.3 Constructors"), constructorsconstexpr explicit polymorphic(); constexpr explicit polymorphic(allocator_arg_t, const Allocator& a); constexpr polymorphic(const polymorphic& other); constexpr polymorphic(allocator_arg_t, const Allocator& a, const polymorphic& other); constexpr polymorphic(polymorphic&& other) noexcept; constexpr polymorphic(allocator_arg_t, const Allocator& a, polymorphic&& other)noexcept(*see below*); template<class U = T>constexpr explicit polymorphic(U&& u); template<class U = T>constexpr explicit polymorphic(allocator_arg_t, const Allocator& a, U&& u); template<class U, class... Ts>constexpr explicit polymorphic(in_place_type_t<U>, Ts&&... ts); template<class U, class... Ts>constexpr explicit polymorphic(allocator_arg_t, const Allocator& a,
 in_place_type_t<U>, Ts&&... ts); template<class U, class I, class... Us>constexpr explicit polymorphic(in_place_type_t<U>, initializer_list<I> ilist, Us&&... us); template<class U, class I, class... Us>constexpr explicit polymorphic(allocator_arg_t, const Allocator& a,
 in_place_type_t<U>, initializer_list<I> ilist, Us&&... us); // [[polymorphic.dtor]](polymorphic.dtor "20.4.2.4 Destructor"), destructorconstexpr ~polymorphic(); // [[polymorphic.assign]](polymorphic.assign "20.4.2.5 Assignment"), assignmentconstexpr polymorphic& operator=(const polymorphic& other); constexpr polymorphic& operator=(polymorphic&& other) noexcept(*see below*); // [[polymorphic.obs]](polymorphic.obs "20.4.2.6 Observers"), observersconstexpr const T& operator*() const noexcept; constexpr T& operator*() noexcept; constexpr const_pointer operator->() const noexcept; constexpr pointer operator->() noexcept; constexpr bool valueless_after_move() const noexcept; constexpr allocator_type get_allocator() const noexcept; // [[polymorphic.swap]](polymorphic.swap "20.4.2.7 Swap"), swapconstexpr void swap(polymorphic& other) noexcept(*see below*); friend constexpr void swap(polymorphic& lhs, polymorphic& rhs) noexcept(*see below*); private: Allocator *alloc* = Allocator(); // *exposition only*};}
