/* * Container.h Step 5, Types. */ #ifndef CONTAINER_H #define CONTAINER_H #include #include template class Container { public: using value_type = T; // added using pointer = value_type*; // added using const_pointer = const value_type*; // added using reference = value_type&; // added using const_reference = const value_type&; // added 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; void push_back(const_reference); // parameter type replaced reference back(); // return type replaced const_reference back() const; // return type replaced void pop_back() noexcept; void swap(Container&) noexcept; private: pointer start_{ nullptr }; // type replaced pointer finish_{ nullptr }; // type replaced pointer end_of_storage_{ nullptr }; // type replaced size_type compute_capacity_() const; T* allocate_(size_type); void deallocate_(pointer); // parameter type replaced T* allocate_and_copy_(const Container&); void resize_(const_reference); // parameter type replaced }; template void swap(Container&, Container&) noexcept; #include "Container.tcc" #endif