SlideShare a Scribd company logo
STANDARD
TEMPLATE LIBRARY
K.Thamizhselvi
Asst. Prof. of Computer Science,
Bon Secours College for Women, Thanjavur.
Standard Template Library
• The collection o generic classes and functions
is called the Standard Template Library (STL).
• STL components are defined in the
namespace std. to inform the compiler to use
standard C++ library.
• Directive
using namespace std;
Benefits of STL
• Using STL we can save time and effort
• Leads to high quality programs
• Well- written and well-tested components are
defined in STL.
Components of STL
Three key components
Containers
Algorithms
Iterators
Relationship between Three STL Components
Object
1
Object
2
Object
3
Algorithm 3
Algorithm 1 Algorithm 2
Iterator 1 Iterator 2
Iterator 3
Container
These 3 components work in conjunction with one another to provide
support to a variety of programming solutions.
Algorithms employ iterators to perform operations stored in
containers.
• A container is an object that actually stores data. It is a way data is
organized in memory. Containers are implemented by template
classes.
• An algorithm is a procedure that is used to process the data
contained in the containers. They are implemented by template
functions.
• An iterator is an object that points to an element in a container. It
connect algorithms with containers and play a key role in
manipulation of data stored in the containers.
CONTAINERS
• Containers are the objects that hold data of
same type.
• Each container class defines a set of functions
that can be used to manipulate its contents.
Types of Containers
Containers
Sequence
Containers
Derived
Containers
Associative
Containers
deque
list
vector
mapmultiset
multimapset
queue
stack Priority
_queue
Sequence Containers
• Stores elements in a linear sequence.
Element 0 Element 1 …. Last element
3 types of sequence container:
Vector
List
Deque
• Vector container defines functions for inserting
elements, erasing the contents and swapping the
contents of two vectors.
• Elements in all these containers can be accessed by
an iterators.
Associative Containers
• Designed to support direct access to elements using
keys.
–4 types
•Set
•Multiset
•Map
•Multimap
• All these containers store data in a structure  Tree
• Set & Multiset can store no. of items and provide
operations for manipulating them using the
values as the keys.
• Mutiset allows duplicate items
• Set does not allows.
• Map & Multimap are used to store pair of items,
one is key and another is value.
• Map allows only one key to store.
• Multimap permits multiple keys.
DERIVED CONTAINERS
• 3 Types:
–Stack
–Queue
–Priority_queue
• These are also called container adaptors.
• It does not support iterators.
• It cannot be used for data manipulation.
• To implement deleting and inserting pop() &
push() operations are used.
ALGORITHMS
• Used to work with two different types of
containers at the same time.
• STL Algorithms are standalone template
function.
• <algorithm> must be included to access the
STL algorithm.
• STL provides more than 60 algorithms to
support complex operations.
ITERATORS
• Used to access containers elements.
• The process of traversing from one element to
another  iterating .
• Types:
 Input
 Output
 Forward
 Bidirectional
 Random
• Input & Output iterators support the least
functions and they can be used only to
traverse in a container.
• The forward supports all operations of input &
output and also retains its position in
containers.
• A bidirectional iterator while support all
forward iterator operations, provide the ability
to move in the backward direction.
• A random access iterator combine the
functionality of bidirectional iterators with an
ability to jump to an arbitrary location.

More Related Content

What's hot

R Data Structures (Part 1)
R Data Structures (Part 1)R Data Structures (Part 1)
R Data Structures (Part 1)
Victor Ordu
 
R data-structures-3
R data-structures-3R data-structures-3
R data-structures-3
Victor Ordu
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
karthikeyanC40
 
R data structures-2
R data structures-2R data structures-2
R data structures-2
Victor Ordu
 
Ei u4
Ei u4Ei u4
Abstract data types (adt) intro to data structure part 2
Abstract data types (adt)   intro to data structure part 2Abstract data types (adt)   intro to data structure part 2
Abstract data types (adt) intro to data structure part 2
Self-Employed
 
Matlab Organizing Data
Matlab Organizing DataMatlab Organizing Data
Matlab Organizing Data
DataminingTools Inc
 
Data structure
Data structureData structure
Data structure
Prof. Dr. K. Adisesha
 
Presentation of array
Presentation of arrayPresentation of array
Presentation of array
Shamim Hossain
 
4 chapter3 list_stackqueuepart1
4 chapter3 list_stackqueuepart14 chapter3 list_stackqueuepart1
4 chapter3 list_stackqueuepart1
SSE_AndyLi
 
Collections Training
Collections TrainingCollections Training
Collections Training
Ramindu Deshapriya
 
Arrays accessing using for loops
Arrays accessing using for loopsArrays accessing using for loops
Arrays accessing using for loops
sangrampatil81
 
L 15 ct1120
L 15 ct1120L 15 ct1120
L 15 ct1120
Zia Ush Shamszaman
 
Intro to Lists
Intro to ListsIntro to Lists
Intro to Lists
primeteacher32
 
Data structure lecture 1
Data structure lecture 1Data structure lecture 1
Data structure lecture 1Kumar
 
Quick sort data structures
Quick sort data structuresQuick sort data structures
Quick sort data structures
chauhankapil
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
Rohit Rai
 

What's hot (19)

R Data Structures (Part 1)
R Data Structures (Part 1)R Data Structures (Part 1)
R Data Structures (Part 1)
 
R data-structures-3
R data-structures-3R data-structures-3
R data-structures-3
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
 
R data structures-2
R data structures-2R data structures-2
R data structures-2
 
Ei u4
Ei u4Ei u4
Ei u4
 
Abstract data types (adt) intro to data structure part 2
Abstract data types (adt)   intro to data structure part 2Abstract data types (adt)   intro to data structure part 2
Abstract data types (adt) intro to data structure part 2
 
The awesome algorithm
The awesome algorithmThe awesome algorithm
The awesome algorithm
 
Matlab Organizing Data
Matlab Organizing DataMatlab Organizing Data
Matlab Organizing Data
 
Data structure
Data structureData structure
Data structure
 
Presentation of array
Presentation of arrayPresentation of array
Presentation of array
 
4 chapter3 list_stackqueuepart1
4 chapter3 list_stackqueuepart14 chapter3 list_stackqueuepart1
4 chapter3 list_stackqueuepart1
 
Collections Training
Collections TrainingCollections Training
Collections Training
 
Arrays accessing using for loops
Arrays accessing using for loopsArrays accessing using for loops
Arrays accessing using for loops
 
L 15 ct1120
L 15 ct1120L 15 ct1120
L 15 ct1120
 
Intro to Lists
Intro to ListsIntro to Lists
Intro to Lists
 
Data structure lecture 1
Data structure lecture 1Data structure lecture 1
Data structure lecture 1
 
Quick sort data structures
Quick sort data structuresQuick sort data structures
Quick sort data structures
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
 
Lecture7
Lecture7Lecture7
Lecture7
 

Similar to Standard template library

Standard template library
Standard template libraryStandard template library
Standard template library
Sukriti Singh
 
The Standard Template Library
The Standard Template LibraryThe Standard Template Library
The Standard Template Library
Munazza-Mah-Jabeen
 
Understanding the components of standard template library
Understanding the components of standard template libraryUnderstanding the components of standard template library
Understanding the components of standard template library
Rahul Sharma
 
b,Sc it data structure.ppt
b,Sc it data structure.pptb,Sc it data structure.ppt
b,Sc it data structure.ppt
classall
 
Unit 1 array based implementation
Unit 1  array based implementationUnit 1  array based implementation
Unit 1 array based implementation
LavanyaJ28
 
b,Sc it data structure.pptx
b,Sc it data structure.pptxb,Sc it data structure.pptx
b,Sc it data structure.pptx
classall
 
Dynamic Memory & Linked Lists
Dynamic Memory & Linked ListsDynamic Memory & Linked Lists
Dynamic Memory & Linked Lists
Afaq Mansoor Khan
 
lecture 02.2.ppt
lecture 02.2.pptlecture 02.2.ppt
lecture 02.2.ppt
NathanielAdika
 
b,Sc it data structure.pptx
b,Sc it data structure.pptxb,Sc it data structure.pptx
b,Sc it data structure.pptx
classall
 
DS Module1 (1).pptx
DS Module1 (1).pptxDS Module1 (1).pptx
DS Module1 (1).pptx
AnuJoseph95
 
Data Structure & Algorithm.pptx
Data Structure & Algorithm.pptxData Structure & Algorithm.pptx
Data Structure & Algorithm.pptx
Mumtaz
 
Unit 2 linear data structures
Unit 2   linear data structuresUnit 2   linear data structures
Unit 2 linear data structures
Senthil Murugan
 
02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt
Yonas D. Ebren
 
DOC-20221104-WA0036. بيانات.pptx
DOC-20221104-WA0036. بيانات.pptxDOC-20221104-WA0036. بيانات.pptx
DOC-20221104-WA0036. بيانات.pptx
ssusercab735
 
standard template library(STL) in C++
standard template library(STL) in C++standard template library(STL) in C++
standard template library(STL) in C++
•sreejith •sree
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & Algorithms
Akhil Kaushik
 
Python programming
Python programmingPython programming
Python programming
sirikeshava
 
Standard template library
Standard template libraryStandard template library
Standard template library
Jancypriya M
 
Skillwise - Enhancing dotnet app
Skillwise - Enhancing dotnet appSkillwise - Enhancing dotnet app
Skillwise - Enhancing dotnet app
Skillwise Group
 
oops_final_ppt[1].pptx
oops_final_ppt[1].pptxoops_final_ppt[1].pptx
oops_final_ppt[1].pptx
12KrishnaPrasadH
 

Similar to Standard template library (20)

Standard template library
Standard template libraryStandard template library
Standard template library
 
The Standard Template Library
The Standard Template LibraryThe Standard Template Library
The Standard Template Library
 
Understanding the components of standard template library
Understanding the components of standard template libraryUnderstanding the components of standard template library
Understanding the components of standard template library
 
b,Sc it data structure.ppt
b,Sc it data structure.pptb,Sc it data structure.ppt
b,Sc it data structure.ppt
 
Unit 1 array based implementation
Unit 1  array based implementationUnit 1  array based implementation
Unit 1 array based implementation
 
b,Sc it data structure.pptx
b,Sc it data structure.pptxb,Sc it data structure.pptx
b,Sc it data structure.pptx
 
Dynamic Memory & Linked Lists
Dynamic Memory & Linked ListsDynamic Memory & Linked Lists
Dynamic Memory & Linked Lists
 
lecture 02.2.ppt
lecture 02.2.pptlecture 02.2.ppt
lecture 02.2.ppt
 
b,Sc it data structure.pptx
b,Sc it data structure.pptxb,Sc it data structure.pptx
b,Sc it data structure.pptx
 
DS Module1 (1).pptx
DS Module1 (1).pptxDS Module1 (1).pptx
DS Module1 (1).pptx
 
Data Structure & Algorithm.pptx
Data Structure & Algorithm.pptxData Structure & Algorithm.pptx
Data Structure & Algorithm.pptx
 
Unit 2 linear data structures
Unit 2   linear data structuresUnit 2   linear data structures
Unit 2 linear data structures
 
02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt
 
DOC-20221104-WA0036. بيانات.pptx
DOC-20221104-WA0036. بيانات.pptxDOC-20221104-WA0036. بيانات.pptx
DOC-20221104-WA0036. بيانات.pptx
 
standard template library(STL) in C++
standard template library(STL) in C++standard template library(STL) in C++
standard template library(STL) in C++
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & Algorithms
 
Python programming
Python programmingPython programming
Python programming
 
Standard template library
Standard template libraryStandard template library
Standard template library
 
Skillwise - Enhancing dotnet app
Skillwise - Enhancing dotnet appSkillwise - Enhancing dotnet app
Skillwise - Enhancing dotnet app
 
oops_final_ppt[1].pptx
oops_final_ppt[1].pptxoops_final_ppt[1].pptx
oops_final_ppt[1].pptx
 

More from ThamizhselviKrishnam

Templates in c++
Templates in c++Templates in c++
Templates in c++
ThamizhselviKrishnam
 
Operators and expression in c++
Operators and  expression in c++Operators and  expression in c++
Operators and expression in c++
ThamizhselviKrishnam
 
Functions, classes & objects in c++
Functions, classes & objects in c++Functions, classes & objects in c++
Functions, classes & objects in c++
ThamizhselviKrishnam
 
Page maker - working with text
Page maker - working with textPage maker - working with text
Page maker - working with text
ThamizhselviKrishnam
 
Microprocessor & architecture
Microprocessor & architectureMicroprocessor & architecture
Microprocessor & architecture
ThamizhselviKrishnam
 
Instruction set of 8085
Instruction set of 8085Instruction set of 8085
Instruction set of 8085
ThamizhselviKrishnam
 
Memory and storage devices
Memory and storage devicesMemory and storage devices
Memory and storage devices
ThamizhselviKrishnam
 
Generations of computer
Generations of computerGenerations of computer
Generations of computer
ThamizhselviKrishnam
 
Adobe Pagemaker 7.0
Adobe Pagemaker 7.0Adobe Pagemaker 7.0
Adobe Pagemaker 7.0
ThamizhselviKrishnam
 
classification of digital computer
classification of digital computerclassification of digital computer
classification of digital computer
ThamizhselviKrishnam
 
Pagemaker
PagemakerPagemaker

More from ThamizhselviKrishnam (11)

Templates in c++
Templates in c++Templates in c++
Templates in c++
 
Operators and expression in c++
Operators and  expression in c++Operators and  expression in c++
Operators and expression in c++
 
Functions, classes & objects in c++
Functions, classes & objects in c++Functions, classes & objects in c++
Functions, classes & objects in c++
 
Page maker - working with text
Page maker - working with textPage maker - working with text
Page maker - working with text
 
Microprocessor & architecture
Microprocessor & architectureMicroprocessor & architecture
Microprocessor & architecture
 
Instruction set of 8085
Instruction set of 8085Instruction set of 8085
Instruction set of 8085
 
Memory and storage devices
Memory and storage devicesMemory and storage devices
Memory and storage devices
 
Generations of computer
Generations of computerGenerations of computer
Generations of computer
 
Adobe Pagemaker 7.0
Adobe Pagemaker 7.0Adobe Pagemaker 7.0
Adobe Pagemaker 7.0
 
classification of digital computer
classification of digital computerclassification of digital computer
classification of digital computer
 
Pagemaker
PagemakerPagemaker
Pagemaker
 

Recently uploaded

LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 

Recently uploaded (20)

LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 

Standard template library

  • 1. STANDARD TEMPLATE LIBRARY K.Thamizhselvi Asst. Prof. of Computer Science, Bon Secours College for Women, Thanjavur.
  • 2. Standard Template Library • The collection o generic classes and functions is called the Standard Template Library (STL). • STL components are defined in the namespace std. to inform the compiler to use standard C++ library. • Directive using namespace std;
  • 3. Benefits of STL • Using STL we can save time and effort • Leads to high quality programs • Well- written and well-tested components are defined in STL.
  • 4. Components of STL Three key components Containers Algorithms Iterators
  • 5. Relationship between Three STL Components Object 1 Object 2 Object 3 Algorithm 3 Algorithm 1 Algorithm 2 Iterator 1 Iterator 2 Iterator 3 Container
  • 6. These 3 components work in conjunction with one another to provide support to a variety of programming solutions. Algorithms employ iterators to perform operations stored in containers. • A container is an object that actually stores data. It is a way data is organized in memory. Containers are implemented by template classes. • An algorithm is a procedure that is used to process the data contained in the containers. They are implemented by template functions. • An iterator is an object that points to an element in a container. It connect algorithms with containers and play a key role in manipulation of data stored in the containers.
  • 7. CONTAINERS • Containers are the objects that hold data of same type. • Each container class defines a set of functions that can be used to manipulate its contents.
  • 9. Sequence Containers • Stores elements in a linear sequence. Element 0 Element 1 …. Last element 3 types of sequence container: Vector List Deque • Vector container defines functions for inserting elements, erasing the contents and swapping the contents of two vectors. • Elements in all these containers can be accessed by an iterators.
  • 10. Associative Containers • Designed to support direct access to elements using keys. –4 types •Set •Multiset •Map •Multimap • All these containers store data in a structure  Tree
  • 11. • Set & Multiset can store no. of items and provide operations for manipulating them using the values as the keys. • Mutiset allows duplicate items • Set does not allows. • Map & Multimap are used to store pair of items, one is key and another is value. • Map allows only one key to store. • Multimap permits multiple keys.
  • 12. DERIVED CONTAINERS • 3 Types: –Stack –Queue –Priority_queue • These are also called container adaptors. • It does not support iterators. • It cannot be used for data manipulation. • To implement deleting and inserting pop() & push() operations are used.
  • 13. ALGORITHMS • Used to work with two different types of containers at the same time. • STL Algorithms are standalone template function. • <algorithm> must be included to access the STL algorithm. • STL provides more than 60 algorithms to support complex operations.
  • 14. ITERATORS • Used to access containers elements. • The process of traversing from one element to another  iterating . • Types:  Input  Output  Forward  Bidirectional  Random
  • 15. • Input & Output iterators support the least functions and they can be used only to traverse in a container. • The forward supports all operations of input & output and also retains its position in containers. • A bidirectional iterator while support all forward iterator operations, provide the ability to move in the backward direction. • A random access iterator combine the functionality of bidirectional iterators with an ability to jump to an arbitrary location.