C++ stl


STL

C++ Stl provide many features ,inbuilt functions and many data strucutres.C++ stl is very powerful and useful  library to implement data structures and algorithms.

The C++ STL (Standard Template Library) is a powerful set of C++ template classes to provide general-purpose classes and functions with templates that implement many popular and commonly used algorithms and data structures like vectorslistsqueues, and stacks

Advantages:-
1.Support of Generic programming
2.Deliver fast, efficient code
3.Easy to use
Disadvantages:-
1.Template by its nature exposes its implementation
2.NO information hiding

STL LIST:-

Features:-

front() – first element
back() – last emement
push_front(g) – add element at front
push_back(g) –add element at back
pop_front() p- pop from front
pop_back()--pop from back
size() – Returns the number of elements in the list
sort() – Sorts the list in increasing order


Syntax:-
#include<iostream>
#include<list>
using namespace std;
int main()
{
int a=10;

list<int> list1;

list1.push_back(a);

cout<<list1.front(); //print 10

cout<<list1.size(); //print 1

list1.push_back(3);

list1.sort(); //it sort the list

return 0;

}

For Stacks and Queues:-




1 comment:

  1. Hello There,


    The challenge however, is we don’t yet know how it will be used making too hard to assess their value proposition and consequently value.

    We are a technology company in South Africa with a few power electronic products containing micros with custom written software in C. We are trying now as non software engineers, with basic understanding of C to try and understand or interpret our software into basic english if I may put it that way. We are the hardware engineers and designed the unit but did not write the software ourselves.

    if I posted sections of code, would someone be able to translate this for us and also write new improved modifications that we require

    But nice Article Mate! Great Information! Keep up the good work!


    Many Thanks,
    Nithya

    ReplyDelete