C++C++11C++14C++17Introduction to C++Learn C++

How To Use C++ front() And back() Methods Of Vectors

What are the Vectors in C++? How can I use front() iterator method on vectors? How can I use back() iterator method on vectors? Can I get the last member of a vector by using back() method? How can I access to the first element of a vector? Can I print out the first and the last members of vectors by using front() and back() methods? Let’s answer these questions.
Read more
C++C++11C++14C++17Iterators

Insert Iterators Adapters in C++

Let’s slightly modify the example from The Move Iterator Adapter in C++ post: #include <algorithm> #include <list> #include <string> #include <vector> /// @warning BUG! PLEASE, DON'T USE! auto deep_copy_to_list(const std::vector<std::string>& src) { std::list<std::string> dst; // constructs the empty list copy(cbegin(src), cend(src)…
Read more
C++C++11C++14C++17IteratorsLearn C++

Categories of Iterators in C++

Conceptually, iterators are consists of five categories: input iterator is intended to traverse sequences in the forward direction and provides the read access to the pointed sequence element;output iterator is intended to traverse sequences in the forward direction and provides the write access to the pointed sequence element;forward iterator is intended to traverse sequences in the forward…
Read more