We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Tag: in

How to use vector efficiently in C++?

We can use vector efficiently by taking care of following points, 1.) Vector will be more efficient if elements are inserted or removed from the back-end only. Advertisements As, vector internally stores all the elements in consecutive memory location. Therefore, if an element is added in middle, then vector right shifts all the right side …

How to use vector efficiently in C++?Read More

Designing Callbacks in C++ – Part 1: Function Pointers

Callback Mechanism Exmplained

In this article we will discuss what is a callback and what types of callbacks we can have in C++ and how to Design Callbacks as function pointers. Now what is a callback? Advertisements Callback is a function that we pass to another APIs as argument while calling them. Now these APIs are expected to …

Designing Callbacks in C++ – Part 1: Function PointersRead More

Designing Callbacks in C++ – Part 2: Function Objects & Functors

In this article we will discuss, what is a Function Object, why do we need function objects and how to use function objects as Callbacks. What is a Function Objects: Advertisements A Function Object / Functor is a kind of Callback with State. In a Programmer’s terminology, Frequently Asked: Designing Callbacks in C++ – Part …

Designing Callbacks in C++ – Part 2: Function Objects & FunctorsRead More

How to trim strings in C++ using Boost String Algorithm Library

In this tutorial we will discuss how to use trim algorithms from C++ Boost String Algorithm Library. Let’s learn them step by step, Boost String algorithm library provides different algorithms for string trimmings. Let’s first discuss the simple one i.e, What if we want to trim the string of white spaces from left side or …

How to trim strings in C++ using Boost String Algorithm LibraryRead More

Different Ways to Initialize a vector in C++

In this article we will discuss different ways to initialize a std::vector in C++. Initializing std::vector elements with same value std::vector<int> vec_1(5, 10); It will create a vector of 5 element and initialize  each element is initialized to 10. Advertisements Initializing std::vector elements with passed argument list std::vector<int> vec_2 = {10,20,30,40,50}; It will create a vector of 5 …

Different Ways to Initialize a vector in C++Read More

Designing a Board Game (Mastermind) in C++ using MVC, State and Observer Design Patterns

High Level Design - MVC - Board Game

Let’s Design a Console Based Board Game in C++. With this Design you can learn MVC, Observer and State Design Pattern. Moreover, with the same design you can also implement any other Game Like Battleship etc. Advertisements In this we will build Console Based Version of MasterMind Game. Complete Code for this is available at, Frequently …

Designing a Board Game (Mastermind) in C++ using MVC, State and Observer Design PatternsRead More

How to pass variable arguments in a function

In this article we will discuss how to pass variable number of arguments in a function. Requirement: Advertisements Suppose I want to create a function that take variable number of arguments and use them to perform some task. For example, Create a function that will return the sum of all the passed arguments i.e. Frequently …

How to pass variable arguments in a functionRead More

9
499.230,55