/* * Container.h Step 3, Clearing and swapping. */ #ifndef CONTAINER_H #define CONTAINER_H #include template class Container { public: using size_type = std::size_t; Container() noexcept = default; explicit Container(const size_type n); Container(const Container&); Container(Container&&) noexcept; ~Container(); Container& operator=(const Container&) &; Container& operator=(Container&&) & noexcept; size_type size() const noexcept; size_type max_size() const noexcept; size_type capacity() const noexcept; bool empty() const noexcept; void clear() noexcept; // added void swap(Container&) noexcept; // added private: T* start_{ nullptr }; T* finish_{ nullptr }; T* end_of_storage_{ nullptr }; T* allocate_(size_type); void deallocate_(T*); T* allocate_and_copy_(const Container&); }; template void swap(Container&, Container&) noexcept; // added #include "Container.tcc" #endif