Sorting is done in increasing order by default. This function sorts the elements of the list. (Reverse is done on the basis of order of elements) This function reverses the elements of the list container. It also reduces the list of the list by 1. This function pops out the last element of the list. This function removes/ pops out the element front of the list or the first element of the list. This function pushes the element at the end of the list This function pushes the element at the front/starting of the element This function checks whether the list container is empty or not. This function access the last element of the list This function helps in accessing the first element of the list This function returns the total size of the list This function returns the iterator pointing to the end/ last element of the list This function returns the iterator which is pointing to the starting/ first element of the list Some of the commonly used list functions are given below: Method Name A zero size list is also possible practically. List in C++ provides us the facility to increase or decrease the size of it at runtime.For the small number of elements, List is not considered to be a good option as it occupies more space in the memory as compared to other containers keeping the track of its preceding and previous element through links.One needs to traverse the whole list till the required element is found in order to perform any operation. As compared to other sequence containers, the performance of List is not as good as the direct access of the elements is not possible.But once the element is found, operations like insertion and deletion become very easy. List in C++ has a slow traversal as a comparison to the Vectors.Elements in the list are connected with each other using the link of the doubly linked list of its proceeding and the previous elements.The list allows the non- contiguous storage of elements which means Elements of the list can be stored at different locations in the memory.List in C++ is implemented as a doubly-linked list which allows the operations like insertion, deletion, and access from both directions.Alloc: It is an allocator object and defines the memory allocation.įew important points defining the working and features of the list in C++ are given below:.It can be a user-defined type of element. T: It is the type of element to be stored in the list.One needs to import the header file to use the list in the program.
#STRING ARRAY VS ARRAYLIST SOFTWARE#
Web development, programming languages, Software testing & othersīelow given is the basic syntax of using the list on C++ programs:
#STRING ARRAY VS ARRAYLIST FREE#
Start Your Free Software Development Course