In this article, we saw how to bind a function with parameters and placeholders and some of its benefits. There we used a normal function. Here will see how to bind member function of a class. Binding a Static Member Function Binding a static member function is just like binding a normal function. The func() … Continue reading “C++ | Binding a Member Function”
C++ | std::bind(), the forwarding call wrapper
C++11 introduced the std::bind() to create a forwarding call wrapper for a function associated argument values. We can bind a function with its parameters to get a callable object. We can call that object anytime later. In fact, calling that callable object and the actual function with the bound parameters are the same. Let’s take … Continue reading “C++ | std::bind(), the forwarding call wrapper”
C++ | Two Dimensional Vector
Two dimensional vector (or 2D vector) in C++ represents a table like structure that has two dimensions, row and column. It is, in fact, a standard STL vector of type vector. Vectors can be nested up to any depth. Here we’ll use two level nesting for two dimensions. Initialization We can initialize the values of … Continue reading “C++ | Two Dimensional Vector”
C++ | Vector, the Dynamic Array
C++ Standard Template Library (STL) provides the data structure, Vector, that represents a dynamic array internally. As the vector is a template class, it can represent an array of virtually any data type. Here we’ll see how the Vector can represent an integer array. The vector data structure has many advantages over a traditional array. … Continue reading “C++ | Vector, the Dynamic Array”
C++ | Roman to Decimal Conversion
Roman numerals are a number system that was originated from ancient Rome. Even though it is sort of obsolete, we often come across Roman numerals in various places. They are often used in movie titles, monarch names, chemistry periodic tables, sporting events among others. Sometimes it is difficult to read, especially the big numbers, for … Continue reading “C++ | Roman to Decimal Conversion”