We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Tag: examples

C++11 Smart Pointer – Part 1: shared_ptr Tutorial and Examples

In this article we will discuss a smart pointer implementation provide by c++11 i.e. shared_ptr. What is std::shared_ptr<> ? shared_ptr is a kind of Smart Pointer class provided by c++11, that is smart enough to automatically delete the associated pointer when its not used anywhere. Thus helps us to completely remove the problem of memory leaks …

C++11 Smart Pointer – Part 1: shared_ptr Tutorial and ExamplesRead More

std::for_each Tutorial : Usage Details with Examples

The std::for_each() algorithm allows us to iterate over a given range of elements and perform operations over them.When to use std::for_each() ? Whenever you are iterating over the elements in a array or in a container and performing some different opeartions over them like accessing, modifying etc. Although you can achieve the same by typing …

std::for_each Tutorial : Usage Details with ExamplesRead More

Compiling C++ with Debug Symbols – gdb debugger Tutorial & Examples

In this article we will discuss how to build a C++ / C code in debug mode and how to start the debugging using gdb. Compile Code with Debug Symbols To debug a C or C++ application with gdb, it should be built in debug mode. So that debug symbols can be loaded and used …

Compiling C++ with Debug Symbols – gdb debugger Tutorial & ExamplesRead More

Breakpoints and Backtrace traversal – gdb debugger Tutorial & Examples

In this article we will discuss how to use breakpoints in gdb and check backtrace etc. How to add breakpoints in gdb Breakpoints can be added only at “gdb” prompt i.e. (gdb) To add a breakpoint in running application just press the “Ctrl-C” command to get the “gdb prompt back. Otherwise you can also add …

Breakpoints and Backtrace traversal – gdb debugger Tutorial & ExamplesRead More

Conditional Breakpoints and watchpoints | gdb debugger Tutorial and examples

Conditional Breakpoints Adding a simple breakpoint at a line will stop the running programming whenever that line of code is hit. But this might not be the requirement every time. Suppose we want to add a kind of breakpoint on a line that will get hit only when a condition is met, not always. Let’s …

Conditional Breakpoints and watchpoints | gdb debugger Tutorial and examplesRead More

std::initializer_list Tutorial & Examples | C++11

std::initializer_list<T> is introduced in C++11 to make initialization uniform in C++. Before C++11 it was easy to initialize an array with with default elements like, Advertisements // Initializing array with default values int arr[]= {1,2,3,4,5}; But there was no way no to initialize other containers like vector, list and map etc. For example, there was no …

std::initializer_list Tutorial & Examples | C++11Read More

C++11 – Variadic Template Function | Tutorial & Examples

Variadic Template is introduced in C++11. Variadic Template allows a function to take variable number of arguments of any type. Let’s understand by an example. Advertisements Suppose we want to create a function log() that accepts variable number of arguments of any type and prints them on console i.e. log(1,4.3, “Hello”); log(‘a’, “test”, 78L, 5); class Student; Student …

C++11 – Variadic Template Function | Tutorial & ExamplesRead More

Cart

Your Cart is Empty

Back To Shop