SlideShare a Scribd company logo
1 of 13
Azerbaijan State Oil and Industry University
Computer Science
Subject: Fundamentals of Programming
Student: Rasulzade Shams
Group: 606.20E
Introduction to C++
Standard Library.
Class Template vector.
C++ Programming Language
C++ is a general-purpose programming language created by Bjarne
Stroustrup in Bell Labs as an extension of the C programming
language, or "C with Classes". The language has expanded
significantly over time, and modern C++ now has object-oriented,
generic, and functional features in addition to facilities for low-level
memory manipulation. It is almost always implemented as a
compiled language, and many vendors provide C++ compilers,
including the Free Software Foundation, Microsoft, Intel, Oracle,
and IBM, so it is available on many platforms.
C++ has also been found useful in many other contexts,
with key strengths being software infrastructure and
resource-constrained applications, including desktop
applications, video games, servers (web search, or SQL
servers), and performance-critical applications (telephone
switches or space probes).
C++ Programming Language
The C++ language has two main components: a direct mapping
of hardware features provided primarily by the C subset, and
zero-overhead abstractions based on those mappings.
Stroustrup describes C++ as "a light-weight abstraction
programming language designed for building and using
efficient and elegant abstractions"; and "offering both
hardware access and abstraction is the basis of C++.
Doing it efficiently is what distinguishes it from other
languages."
C++ Programming Language
#include <iostream>
using namespace std;
int main()
{
cout<< "Hello, world!n";
return 0;
}
C++ inherits most of C's syntax.
Hello world program that uses the C++ Standard Library to write a message to standard output:
The C++ standard consists of two parts: the core language and the standard
library.
C++ programmers expect the latter on every major implementation of C++; it
includes aggregate types (vectors, lists, maps, sets, queues, stacks, arrays, ),
algorithms (find, for_each, binary_search, random_shuffle, etc.), input/output
facilities (iostream, for reading from and writing to the console and files),
filesystem library, localization support, smart pointers for automatic memory
management, regular expression support, time utilities (measurement, getting
current time, etc.), a random number generator and a slightly modified version
of the C standard library (to make it comply with the C++ type system).
C++ Standard Library
A large part of the C++ library is based on the Standard Template Library
(STL). Useful tools provided by the STL include containers as the collections
of objects (such as vectors and lists), iterators that provide array-like access to
containers, and algorithms that perform operations such as searching and
sorting.
As in C, the features of the library are accessed by using the #include directive
to include a standard header.
The C++ Standard Library provides 105 standard headers, of which 27 are
deprecated.
C++ Standard Library
Class Template vector
Templates are the mechanism by which C++ implements
the generic concept. Simply, they allow you to pass data type as
a parameter so that you don’t need to write the same code for different
data types.
Sometimes, you need a class implementation that is same for all classes,
only the data types used are different.
Normally, you would need to create a different class for each data type
OR create different member variables and functions within a single
class.This will unnecessarily bloat your code base and will be hard to
maintain, as a change is one class/function should be performed on all
classes/functions.
However, class templates make it easy to reuse the same code for all
data types.
The C++ Standard Library contains many class templates, in particular
the containers adapted from the Standard Template Library, such
as vector.
The elements of a vector are stored contiguously. Like all dynamic
array implementations, vectors have low memory usage. Unlike other
STL containers, such as lists, vectors allow the user to denote an initial
capacity for the container.
Vectors allow random access; that is, an element of a vector may be
referenced in the same manner as elements of arrays (by array indices).
A typical vector implementation consists, internally, of a pointer to a
dynamically allocated array, and possibly data members holding the
capacity and size of the vector. The size of the vector refers to the
actual number of elements, while the capacity refers to the size of the
internal array.
Class Template vector
The template class that has defined
above serves to store elements of any
valid type.
So as seen, if we wanted to declare an object of
this class to store integer values of type int we
would write:
This same class would also be used to create an
object to store any other type:
Uses of Class Templates
• Remove code duplication
• Generic callback
• Re-use source code as opposed to inheritance and composition, which provides a way to reuse object code
Resources
• https://en.wikipedia.org/wiki/C%2B%2B#Standard_library
• https://en.wikipedia.org/wiki/C%2B%2B_Standard_Library
• https://www.geeksforgeeks.org/templates-cpp/
• https://www.cplusplus.com/reference/vector/vector/
THANK YOU FOR ATTENTION

More Related Content

Similar to Introduction to C++, Standard Library, Class Template vector.pptx

ASP.NET Session 2
ASP.NET Session 2ASP.NET Session 2
ASP.NET Session 2Sisir Ghosh
 
lecture02-cpp.ppt
lecture02-cpp.pptlecture02-cpp.ppt
lecture02-cpp.pptDevliNeeraj
 
C, C++ Training Institute in Chennai , Adyar
C, C++ Training Institute in Chennai , AdyarC, C++ Training Institute in Chennai , Adyar
C, C++ Training Institute in Chennai , AdyarsasikalaD3
 
Stl (standard template library)
Stl (standard template library)Stl (standard template library)
Stl (standard template library)Hemant Jain
 
Learn c sharp at amc square learning
Learn c sharp at amc square learningLearn c sharp at amc square learning
Learn c sharp at amc square learningASIT Education
 
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.docabdulhaq467432
 
DotNet Introduction
DotNet IntroductionDotNet Introduction
DotNet IntroductionWei Sun
 
An Introduction To C++Templates
An Introduction To C++TemplatesAn Introduction To C++Templates
An Introduction To C++TemplatesGanesh Samarthyam
 
UsingCPP_for_Artist.ppt
UsingCPP_for_Artist.pptUsingCPP_for_Artist.ppt
UsingCPP_for_Artist.pptvinu28455
 
Whats New in Visual Studio 2012 for C++ Developers
Whats New in Visual Studio 2012 for C++ DevelopersWhats New in Visual Studio 2012 for C++ Developers
Whats New in Visual Studio 2012 for C++ DevelopersRainer Stropek
 
Collectn framework copy
Collectn framework   copyCollectn framework   copy
Collectn framework copycharan kumar
 
Collectn framework
Collectn frameworkCollectn framework
Collectn frameworkcharan kumar
 

Similar to Introduction to C++, Standard Library, Class Template vector.pptx (20)

ASP.NET Session 2
ASP.NET Session 2ASP.NET Session 2
ASP.NET Session 2
 
lecture02-cpp.ppt
lecture02-cpp.pptlecture02-cpp.ppt
lecture02-cpp.ppt
 
lecture02-cpp.ppt
lecture02-cpp.pptlecture02-cpp.ppt
lecture02-cpp.ppt
 
lecture02-cpp.ppt
lecture02-cpp.pptlecture02-cpp.ppt
lecture02-cpp.ppt
 
lecture02-cpp.ppt
lecture02-cpp.pptlecture02-cpp.ppt
lecture02-cpp.ppt
 
C, C++ Training Institute in Chennai , Adyar
C, C++ Training Institute in Chennai , AdyarC, C++ Training Institute in Chennai , Adyar
C, C++ Training Institute in Chennai , Adyar
 
c++ Unit III - PPT.pptx
c++ Unit III - PPT.pptxc++ Unit III - PPT.pptx
c++ Unit III - PPT.pptx
 
Technical Interview
Technical InterviewTechnical Interview
Technical Interview
 
Stl (standard template library)
Stl (standard template library)Stl (standard template library)
Stl (standard template library)
 
Learn c sharp at amc square learning
Learn c sharp at amc square learningLearn c sharp at amc square learning
Learn c sharp at amc square learning
 
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
 
DotNet Introduction
DotNet IntroductionDotNet Introduction
DotNet Introduction
 
An Introduction To C++Templates
An Introduction To C++TemplatesAn Introduction To C++Templates
An Introduction To C++Templates
 
Modern C++
Modern C++Modern C++
Modern C++
 
UsingCPP_for_Artist.ppt
UsingCPP_for_Artist.pptUsingCPP_for_Artist.ppt
UsingCPP_for_Artist.ppt
 
Whats New in Visual Studio 2012 for C++ Developers
Whats New in Visual Studio 2012 for C++ DevelopersWhats New in Visual Studio 2012 for C++ Developers
Whats New in Visual Studio 2012 for C++ Developers
 
Collectn framework copy
Collectn framework   copyCollectn framework   copy
Collectn framework copy
 
Collectn framework
Collectn frameworkCollectn framework
Collectn framework
 
C++ ppt
C++ pptC++ ppt
C++ ppt
 
C++ ppt.pptx
C++ ppt.pptxC++ ppt.pptx
C++ ppt.pptx
 

More from emsResulzade1

Digital Coding of Images.pptx
Digital Coding of Images.pptxDigital Coding of Images.pptx
Digital Coding of Images.pptxemsResulzade1
 
Computer Networks Slide.pptx
Computer Networks Slide.pptxComputer Networks Slide.pptx
Computer Networks Slide.pptxemsResulzade1
 
Musical Instruments.ppt
Musical Instruments.pptMusical Instruments.ppt
Musical Instruments.pptemsResulzade1
 
How to Detect a Lie.pptx
How to Detect a Lie.pptxHow to Detect a Lie.pptx
How to Detect a Lie.pptxemsResulzade1
 
The MS-DOS File System.pptx
The MS-DOS File System.pptxThe MS-DOS File System.pptx
The MS-DOS File System.pptxemsResulzade1
 
Synchronizing Concurrent Operations in C++.pptx
Synchronizing Concurrent Operations in C++.pptxSynchronizing Concurrent Operations in C++.pptx
Synchronizing Concurrent Operations in C++.pptxemsResulzade1
 

More from emsResulzade1 (6)

Digital Coding of Images.pptx
Digital Coding of Images.pptxDigital Coding of Images.pptx
Digital Coding of Images.pptx
 
Computer Networks Slide.pptx
Computer Networks Slide.pptxComputer Networks Slide.pptx
Computer Networks Slide.pptx
 
Musical Instruments.ppt
Musical Instruments.pptMusical Instruments.ppt
Musical Instruments.ppt
 
How to Detect a Lie.pptx
How to Detect a Lie.pptxHow to Detect a Lie.pptx
How to Detect a Lie.pptx
 
The MS-DOS File System.pptx
The MS-DOS File System.pptxThe MS-DOS File System.pptx
The MS-DOS File System.pptx
 
Synchronizing Concurrent Operations in C++.pptx
Synchronizing Concurrent Operations in C++.pptxSynchronizing Concurrent Operations in C++.pptx
Synchronizing Concurrent Operations in C++.pptx
 

Recently uploaded

Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Recently uploaded (20)

Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 

Introduction to C++, Standard Library, Class Template vector.pptx

  • 1. Azerbaijan State Oil and Industry University Computer Science Subject: Fundamentals of Programming Student: Rasulzade Shams Group: 606.20E
  • 2. Introduction to C++ Standard Library. Class Template vector.
  • 3. C++ Programming Language C++ is a general-purpose programming language created by Bjarne Stroustrup in Bell Labs as an extension of the C programming language, or "C with Classes". The language has expanded significantly over time, and modern C++ now has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation. It is almost always implemented as a compiled language, and many vendors provide C++ compilers, including the Free Software Foundation, Microsoft, Intel, Oracle, and IBM, so it is available on many platforms.
  • 4. C++ has also been found useful in many other contexts, with key strengths being software infrastructure and resource-constrained applications, including desktop applications, video games, servers (web search, or SQL servers), and performance-critical applications (telephone switches or space probes). C++ Programming Language
  • 5. The C++ language has two main components: a direct mapping of hardware features provided primarily by the C subset, and zero-overhead abstractions based on those mappings. Stroustrup describes C++ as "a light-weight abstraction programming language designed for building and using efficient and elegant abstractions"; and "offering both hardware access and abstraction is the basis of C++. Doing it efficiently is what distinguishes it from other languages." C++ Programming Language
  • 6. #include <iostream> using namespace std; int main() { cout<< "Hello, world!n"; return 0; } C++ inherits most of C's syntax. Hello world program that uses the C++ Standard Library to write a message to standard output:
  • 7. The C++ standard consists of two parts: the core language and the standard library. C++ programmers expect the latter on every major implementation of C++; it includes aggregate types (vectors, lists, maps, sets, queues, stacks, arrays, ), algorithms (find, for_each, binary_search, random_shuffle, etc.), input/output facilities (iostream, for reading from and writing to the console and files), filesystem library, localization support, smart pointers for automatic memory management, regular expression support, time utilities (measurement, getting current time, etc.), a random number generator and a slightly modified version of the C standard library (to make it comply with the C++ type system). C++ Standard Library
  • 8. A large part of the C++ library is based on the Standard Template Library (STL). Useful tools provided by the STL include containers as the collections of objects (such as vectors and lists), iterators that provide array-like access to containers, and algorithms that perform operations such as searching and sorting. As in C, the features of the library are accessed by using the #include directive to include a standard header. The C++ Standard Library provides 105 standard headers, of which 27 are deprecated. C++ Standard Library
  • 9. Class Template vector Templates are the mechanism by which C++ implements the generic concept. Simply, they allow you to pass data type as a parameter so that you don’t need to write the same code for different data types. Sometimes, you need a class implementation that is same for all classes, only the data types used are different. Normally, you would need to create a different class for each data type OR create different member variables and functions within a single class.This will unnecessarily bloat your code base and will be hard to maintain, as a change is one class/function should be performed on all classes/functions. However, class templates make it easy to reuse the same code for all data types.
  • 10. The C++ Standard Library contains many class templates, in particular the containers adapted from the Standard Template Library, such as vector. The elements of a vector are stored contiguously. Like all dynamic array implementations, vectors have low memory usage. Unlike other STL containers, such as lists, vectors allow the user to denote an initial capacity for the container. Vectors allow random access; that is, an element of a vector may be referenced in the same manner as elements of arrays (by array indices). A typical vector implementation consists, internally, of a pointer to a dynamically allocated array, and possibly data members holding the capacity and size of the vector. The size of the vector refers to the actual number of elements, while the capacity refers to the size of the internal array. Class Template vector
  • 11. The template class that has defined above serves to store elements of any valid type. So as seen, if we wanted to declare an object of this class to store integer values of type int we would write: This same class would also be used to create an object to store any other type: Uses of Class Templates • Remove code duplication • Generic callback • Re-use source code as opposed to inheritance and composition, which provides a way to reuse object code
  • 12. Resources • https://en.wikipedia.org/wiki/C%2B%2B#Standard_library • https://en.wikipedia.org/wiki/C%2B%2B_Standard_Library • https://www.geeksforgeeks.org/templates-cpp/ • https://www.cplusplus.com/reference/vector/vector/
  • 13. THANK YOU FOR ATTENTION