SlideShare a Scribd company logo
Level up your coding skills with
the C++ Standard Template
Library (STL):
An Introduction to the C++
Standard Library
BY JOYJIT CHOUDHURY
Class
 A class in C++ is a user defined type or
data structure declared with
keyword class that has data and functions
(also called methods) as its members
whose access is governed by the three
access specifiers private, protected or
public (by default access to members of
a class is private).
Class Definition (with int)
Class Definition (with int)
Class Definition (with int, float, char)
Class Definition (with int, float, char)
Template
 Templates are a feature of
the C++ programming language that allows
functions and classes to operate with generic
types. This allows a function or class to work on
many different data types without being
rewritten for each one. It’s a blueprint or formula
for creating a generic class or a function.
Generic Class Definition
Generic Class Definition
C++ Standard Library and STL
 The C++ Standard Library is a collection
of classes and functions, which are written in the core
language and part of the C++ ISO Standard itself.
 The Standard Template Library (STL) is a software library for
the C++ programming language that influenced many parts
of the C++ Standard Library. When the standardisation
happened, the language committee designed parts of the
C++ Standard Library (which is part of the language
standard) to very closely match the STL.
C++ Standard Library and STL
 This part of the C++ Standard Library has been referred
to as by many people – including prominent authors and
cplusplus.com – as the C++ STL.
 The C++ STL (Standard Template Library) is a powerful set
of general-purpose C++ template classes and functions
that implement many popular and commonly used
algorithms and data structures like vectors, lists, queues,
and stacks. It is highly efficient and rigorously tested. It
consists of three well structured components: Containers,
Algorithms and Iterators.
About this course
 In this course we will review some of the powerful
features of the C++ Standard Library (often
referred to as the STL), which is a great tool and
can help save a lot of time in programming
contests. It also makes the code more efficient,
precise and readable.
Containers
 The best way to get familiar with the STL is through
containers.
 A container is a holder object that stores a collection of
other objects (its elements). They are implemented as
class templates, which allows a great flexibility in the
types supported as elements.
 The container manages the storage space for its
elements and provides member functions to access
them, either directly or through iterators (reference
objects with similar properties to pointers).
Containers
 Containers replicate some of the commonly used Data Structures:
Data Structure Container
Linked List list
Stack stack
Queue queue
Dynamic Array vector
Heap Priority_queue
Associative Array Unordered_map, map
…………
pair
 Pair is a struct template that can store two objects of any
type as a single unit
 The individual elements can be accessed through it’s
public members first and second
 Defined in the header <utility>
pair
pair
Why use pair?
 When you have to store two objects of different types as a single unit.
 C++ does not allow returning multiple values from a function, but
allows returning of multiple values enclosed within a structure. In this
case, a pair can be very useful.
 Also, the <, >, == operators are overloaded to compare pairs
lexicographically. What that means is, when comparing two pairs lhs
and rhs, lhs.first and rhs.first are compared first and if both of
them are equal then lhs.second and rhs.second are compared.
Pair : returning a pair of values
Pair : returning a pair of values
Pair: comparison of objects
Pair: comparison of objects
An Introduction to the C++ Standard Library

More Related Content

What's hot

CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCECLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
Venugopalavarma Raja
 
Array in c++
Array in c++Array in c++
Array in c++
Mahesha Mano
 
Collections and its types in C# (with examples)
Collections and its types in C# (with examples)Collections and its types in C# (with examples)
Collections and its types in C# (with examples)
Aijaz Ali Abro
 
Encapsulation
EncapsulationEncapsulation
Encapsulation
Githushan Gengaparam
 
C# Access modifiers
C# Access modifiersC# Access modifiers
C# Access modifiers
Prem Kumar Badri
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
Boopathi K
 
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
Simplilearn
 
Inline Functions and Default arguments
Inline Functions and Default argumentsInline Functions and Default arguments
Inline Functions and Default arguments
Nikhil Pandit
 
Array of objects.pptx
Array of objects.pptxArray of objects.pptx
Array of objects.pptx
RAGAVIC2
 
Wrapper classes
Wrapper classes Wrapper classes
Program control statements in c#
Program control statements in c#Program control statements in c#
Program control statements in c#
Dr.Neeraj Kumar Pandey
 
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B KuteChapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Tushar B Kute
 
OOP Assignment 03.pdf
OOP Assignment 03.pdfOOP Assignment 03.pdf
OOP Assignment 03.pdf
ARSLANMEHMOOD47
 
Java - Packages Concepts
Java - Packages ConceptsJava - Packages Concepts
Java - Packages Concepts
Victer Paul
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaTech_MX
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in python
TMARAGATHAM
 

What's hot (20)

CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCECLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
CLASSES AND OBJECTS IN C++ +2 COMPUTER SCIENCE
 
OOP java
OOP javaOOP java
OOP java
 
Java loops
Java loopsJava loops
Java loops
 
Array in c++
Array in c++Array in c++
Array in c++
 
Vectors in Java
Vectors in JavaVectors in Java
Vectors in Java
 
Collections and its types in C# (with examples)
Collections and its types in C# (with examples)Collections and its types in C# (with examples)
Collections and its types in C# (with examples)
 
Encapsulation
EncapsulationEncapsulation
Encapsulation
 
C# Access modifiers
C# Access modifiersC# Access modifiers
C# Access modifiers
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
 
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
 
Inline Functions and Default arguments
Inline Functions and Default argumentsInline Functions and Default arguments
Inline Functions and Default arguments
 
Array of objects.pptx
Array of objects.pptxArray of objects.pptx
Array of objects.pptx
 
Java packages
Java packagesJava packages
Java packages
 
Wrapper classes
Wrapper classes Wrapper classes
Wrapper classes
 
Program control statements in c#
Program control statements in c#Program control statements in c#
Program control statements in c#
 
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B KuteChapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
 
OOP Assignment 03.pdf
OOP Assignment 03.pdfOOP Assignment 03.pdf
OOP Assignment 03.pdf
 
Java - Packages Concepts
Java - Packages ConceptsJava - Packages Concepts
Java - Packages Concepts
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in python
 

Viewers also liked

Sets
SetsSets
List
ListList
Stack & Queue
Stack & QueueStack & Queue
Stack & Queue
Joyjit Choudhury
 
SPOJ Problem: OLOLO
SPOJ Problem: OLOLOSPOJ Problem: OLOLO
SPOJ Problem: OLOLO
Joyjit Choudhury
 
Maps
MapsMaps
Algorithms: II
Algorithms: IIAlgorithms: II
Algorithms: II
Joyjit Choudhury
 
Priority Queue
Priority QueuePriority Queue
Priority Queue
Joyjit Choudhury
 
Algorithms: I
Algorithms: IAlgorithms: I
Algorithms: I
Joyjit Choudhury
 
Vector
VectorVector
Practical C++ Generative Programming
Practical C++ Generative ProgrammingPractical C++ Generative Programming
Practical C++ Generative Programming
Schalk Cronjé
 
Static and Dynamic polymorphism in C++
Static and Dynamic polymorphism in C++Static and Dynamic polymorphism in C++
Static and Dynamic polymorphism in C++
Anil Bapat
 
State of the Word 2011
State of the Word 2011State of the Word 2011
State of the Word 2011
photomatt
 
TEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of WorkTEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of Work
Volker Hirsch
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & Tricks
SlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShare
SlideShare
 

Viewers also liked (15)

Sets
SetsSets
Sets
 
List
ListList
List
 
Stack & Queue
Stack & QueueStack & Queue
Stack & Queue
 
SPOJ Problem: OLOLO
SPOJ Problem: OLOLOSPOJ Problem: OLOLO
SPOJ Problem: OLOLO
 
Maps
MapsMaps
Maps
 
Algorithms: II
Algorithms: IIAlgorithms: II
Algorithms: II
 
Priority Queue
Priority QueuePriority Queue
Priority Queue
 
Algorithms: I
Algorithms: IAlgorithms: I
Algorithms: I
 
Vector
VectorVector
Vector
 
Practical C++ Generative Programming
Practical C++ Generative ProgrammingPractical C++ Generative Programming
Practical C++ Generative Programming
 
Static and Dynamic polymorphism in C++
Static and Dynamic polymorphism in C++Static and Dynamic polymorphism in C++
Static and Dynamic polymorphism in C++
 
State of the Word 2011
State of the Word 2011State of the Word 2011
State of the Word 2011
 
TEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of WorkTEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of Work
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & Tricks
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShare
 

Similar to An Introduction to the C++ Standard Library

Introduction to C++, Standard Library, Class Template vector.pptx
Introduction to C++, Standard  Library, Class Template  vector.pptxIntroduction to C++, Standard  Library, Class Template  vector.pptx
Introduction to C++, Standard Library, Class Template vector.pptx
emsResulzade1
 
Assg 14 C++ Standard Template Library (STL)(Extra Credit .docx
Assg 14 C++ Standard Template Library (STL)(Extra Credit .docxAssg 14 C++ Standard Template Library (STL)(Extra Credit .docx
Assg 14 C++ Standard Template Library (STL)(Extra Credit .docx
festockton
 
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
abdulhaq467432
 
Standard Template Library!
Standard Template Library!Standard Template Library!
Standard Template Library!
ProgrammingAssignmen4
 
Lecture 8 Library classes
Lecture 8 Library classesLecture 8 Library classes
Lecture 8 Library classes
Syed Afaq Shah MACS CP
 
Collectn framework copy
Collectn framework   copyCollectn framework   copy
Collectn framework copy
charan kumar
 
Collectn framework
Collectn frameworkCollectn framework
Collectn framework
charan kumar
 
Stl (standard template library)
Stl (standard template library)Stl (standard template library)
Stl (standard template library)Hemant Jain
 
AI_2nd Lab.pptx
AI_2nd Lab.pptxAI_2nd Lab.pptx
AI_2nd Lab.pptx
MohammedAlYemeni1
 
Unit 5.ppt
Unit 5.pptUnit 5.ppt
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
HalaiHansaika
 
Learn advanced java programming
Learn advanced java programmingLearn advanced java programming
Learn advanced java programming
TOPS Technologies
 
2CPP16 - STL
2CPP16 - STL2CPP16 - STL
2CPP16 - STL
Michael Heron
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
Amresh Raj
 
C++ language
C++ languageC++ language
C++ language
Hamza Asif
 

Similar to An Introduction to the C++ Standard Library (20)

Introduction to C++, Standard Library, Class Template vector.pptx
Introduction to C++, Standard  Library, Class Template  vector.pptxIntroduction to C++, Standard  Library, Class Template  vector.pptx
Introduction to C++, Standard Library, Class Template vector.pptx
 
Stl dich
Stl dichStl dich
Stl dich
 
Stl
StlStl
Stl
 
Assg 14 C++ Standard Template Library (STL)(Extra Credit .docx
Assg 14 C++ Standard Template Library (STL)(Extra Credit .docxAssg 14 C++ Standard Template Library (STL)(Extra Credit .docx
Assg 14 C++ Standard Template Library (STL)(Extra Credit .docx
 
My c++
My c++My c++
My c++
 
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
 
Standard Template Library!
Standard Template Library!Standard Template Library!
Standard Template Library!
 
Lecture 8 Library classes
Lecture 8 Library classesLecture 8 Library classes
Lecture 8 Library classes
 
Collectn framework copy
Collectn framework   copyCollectn framework   copy
Collectn framework copy
 
Collectn framework
Collectn frameworkCollectn framework
Collectn framework
 
Stl
StlStl
Stl
 
Stl (standard template library)
Stl (standard template library)Stl (standard template library)
Stl (standard template library)
 
AI_2nd Lab.pptx
AI_2nd Lab.pptxAI_2nd Lab.pptx
AI_2nd Lab.pptx
 
Technical Interview
Technical InterviewTechnical Interview
Technical Interview
 
Unit 5.ppt
Unit 5.pptUnit 5.ppt
Unit 5.ppt
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
 
Learn advanced java programming
Learn advanced java programmingLearn advanced java programming
Learn advanced java programming
 
2CPP16 - STL
2CPP16 - STL2CPP16 - STL
2CPP16 - STL
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
 
C++ language
C++ languageC++ language
C++ language
 

Recently uploaded

Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
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
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 

Recently uploaded (20)

Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
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
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 

An Introduction to the C++ Standard Library

  • 1. Level up your coding skills with the C++ Standard Template Library (STL): An Introduction to the C++ Standard Library BY JOYJIT CHOUDHURY
  • 2. Class  A class in C++ is a user defined type or data structure declared with keyword class that has data and functions (also called methods) as its members whose access is governed by the three access specifiers private, protected or public (by default access to members of a class is private).
  • 5. Class Definition (with int, float, char)
  • 6. Class Definition (with int, float, char)
  • 7. Template  Templates are a feature of the C++ programming language that allows functions and classes to operate with generic types. This allows a function or class to work on many different data types without being rewritten for each one. It’s a blueprint or formula for creating a generic class or a function.
  • 10. C++ Standard Library and STL  The C++ Standard Library is a collection of classes and functions, which are written in the core language and part of the C++ ISO Standard itself.  The Standard Template Library (STL) is a software library for the C++ programming language that influenced many parts of the C++ Standard Library. When the standardisation happened, the language committee designed parts of the C++ Standard Library (which is part of the language standard) to very closely match the STL.
  • 11. C++ Standard Library and STL  This part of the C++ Standard Library has been referred to as by many people – including prominent authors and cplusplus.com – as the C++ STL.  The C++ STL (Standard Template Library) is a powerful set of general-purpose C++ template classes and functions that implement many popular and commonly used algorithms and data structures like vectors, lists, queues, and stacks. It is highly efficient and rigorously tested. It consists of three well structured components: Containers, Algorithms and Iterators.
  • 12. About this course  In this course we will review some of the powerful features of the C++ Standard Library (often referred to as the STL), which is a great tool and can help save a lot of time in programming contests. It also makes the code more efficient, precise and readable.
  • 13. Containers  The best way to get familiar with the STL is through containers.  A container is a holder object that stores a collection of other objects (its elements). They are implemented as class templates, which allows a great flexibility in the types supported as elements.  The container manages the storage space for its elements and provides member functions to access them, either directly or through iterators (reference objects with similar properties to pointers).
  • 14. Containers  Containers replicate some of the commonly used Data Structures: Data Structure Container Linked List list Stack stack Queue queue Dynamic Array vector Heap Priority_queue Associative Array Unordered_map, map …………
  • 15. pair  Pair is a struct template that can store two objects of any type as a single unit  The individual elements can be accessed through it’s public members first and second  Defined in the header <utility>
  • 16. pair
  • 17. pair
  • 18. Why use pair?  When you have to store two objects of different types as a single unit.  C++ does not allow returning multiple values from a function, but allows returning of multiple values enclosed within a structure. In this case, a pair can be very useful.  Also, the <, >, == operators are overloaded to compare pairs lexicographically. What that means is, when comparing two pairs lhs and rhs, lhs.first and rhs.first are compared first and if both of them are equal then lhs.second and rhs.second are compared.
  • 19. Pair : returning a pair of values
  • 20. Pair : returning a pair of values