Standard template library


Write the code for each assignment with output screen.

Assignment 1: (Standard Template library)

Complete the implementation of the vector by providing definitions for the following operations:

•         A default constructor, which should create a buffer with capacity 5 and size 0.

•         A constructor that takes an integer argument, and creates a buffer with the given size and capacity. 

•         A member function set_capacity (int), which changes the capacity to the indicated limit, copying elements from the current buffer. If the new capacity is larger than the current size, the size remains unchanged; otherwise the size is made the same as the new capacity. 

•         The operation at, which returns the element at the given location in the buffer. 

•         The operation push_back, which adds the element to the end of the buffer, increasing the size, and invoking set_capacity to increase the capacity of the buffer if necessary.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Standard template library
Reference No:- TGS0178

Expected delivery within 24 Hours