20 Memory management library [mem]

20.4 Types for composite class design [mem.composite.types]

20.4.2 Class template polymorphic [polymorphic]

20.4.2.2 Synopsis [polymorphic.syn]

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], constructors constexpr 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], destructor constexpr ~polymorphic(); // [polymorphic.asgn], assignment constexpr polymorphic& operator=(const polymorphic& other); constexpr polymorphic& operator=(polymorphic&& other) noexcept(see below); // [polymorphic.obs], observers constexpr 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], swap constexpr void swap(polymorphic& other) noexcept(see below); friend constexpr void swap(polymorphic& lhs, polymorphic& rhs) noexcept(see below); private: Allocator alloc = Allocator(); // exposition only }; }