Tag: Iterator
c++ std::vector and Iterator Invalidation example
In this article we will discuss the iterator invalidation with respect to std::vector in C++. What is Iterator Invalidation? An Iterator becomes invalidate when the container it points to changes its shape internally i.e. move elements from one location to another and the initial iterator still points to old invalid location. Advertisements Iterator invalidation in …
C++ map : Erase element by key or Iterator or Range
In this article we will discuss the different ways to delete a key-value pair from map. std::map provides 3 overloaded version of erase() to remove elements from map i.e. Advertisements Erase by key Erase by Iterator Erase a range Lets discuss them one by one, Erase Element from Map by Key std::map provides a erase function that accepts …
C++ map : Erase element by key or Iterator or RangeRead More
Python : Iterator, Iterable and Iteration explained with examples
In this article we will discuss what is Iterator, Iterable and Iterator in python with examples. What is an Iterable? Iterable is kind of object which is a collection of other elements. For example list and tuple are Iterables. It is similar to any collection class in Java or container class in C++. In Python …
Python : Iterator, Iterable and Iteration explained with examplesRead More
Python : How to make a class Iterable & create Iterator Class for it ?
In this article we will discuss how to make your custom class Iterable and also create Iterator class for it. Why should we make a Custom class Iterable ? Custom classes created by us are by default not Iterable. If we want to iterate over the objects of our custom class then we need to …
Python : How to make a class Iterable & create Iterator Class for it ?Read More