Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Beginning C++ Programming

You're reading from   Beginning C++ Programming Modern C++ at your fingertips!

Arrow left icon
Product type Paperback
Published in Apr 2017
Publisher Packt
ISBN-13 9781787124943
Length 526 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Richard Grimes Richard Grimes
Author Profile Icon Richard Grimes
Richard Grimes
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Starting with C++ FREE CHAPTER 2. Understanding Language Features 3. Exploring C++ Types 4. Working with Memory, Arrays, and Pointers 5. Using Functions 6. Classes 7. Introduction to Object-Orientated Programming 8. Using the Standard Library Containers 9. Using Strings 10. Diagnostics and Debugging

Containers

The Standard Library containers allow you to group together zero or more items of the same type and access them serially through iterators. Every such object has a begin method that returns an iterator object to the first item and an end function that returns an iterator object for the item after the last item in the container. The iterator objects support pointer-like arithmetic, so that end() - begin() will give the number of items in the container. All container types will implement the empty method to indicate if there are no items in the container, and (except for forward_list) the size method is the number of items in the container. You are tempted to iterate through a container as if it is an array:

    vector<int> primes{1, 3, 5, 7, 11, 13}; 
for (size_t idx = 0; idx < primes.size(); ++idx)
{
cout << primes[idx] << &quot...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime