This video introduces what generic programming is, along with the different kinds of functions, namely: function, class, and method templates. After tackling the basics, this will help you keep in mind that codes should not be all about the templates. This is mostly for the…
The Move Iterator Adapter in C++
December 6, 2020
The dereference prefix operator * being applied to iterator returns the lvalue reference to the element pointed by the iterator. Therefore, algorithms such as std::copy or std::transform calls copying constructors of processed elements, for example:
#include <algorithm>
#include <list>
#include <string>
#include <vector>
auto deep_copy_to_list(const…
Reverse Iterators in C++
December 6, 2020
By using bidirectional iterator or random access iterator (see Iterator Categories in C++) it’s possible to traverse the sequence in backward direction by using operator -- or by using the special adapter template class std::reverse_iterator. But why to bother with…
Learn C++ With Test Driven C++ by Phil Nash (CPPCon 2020) Video
December 6, 2020
The importance of testing can never be underestimated. Although sometimes, writing tests can be difficult and can be a little time-consuming. But there are other ways to make testing easier, like writing tests first. This video will give you insights on how to get you…
Categories of Iterators in C++
December 5, 2020
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…
Introduction to C++ Iterators
December 5, 2020
Iterator abstracts the concept of pointer to the sequence in range [begin, end), and thus provides the following basic operations:
dereference to obtain the current element;movement to point the next element;comparison to determine at least the end of…
Windows File Operations in Modern C++
December 5, 2020
There are a lot ways to operate on files in C and C++. In C programming is enough to use FILE, fopen(), fclose() operations. In C++ FileOpen().was enough to operate before. In Modern C++ because of multiplatform operating systems, global languages and for the other benefits…