NAVI NING

The very beginning mind itself is the most accomplished mind of true enlightenment.

Multithreaded Programming with std::thread

Multithreading is no longer a hassle

Multithreaded Programming with std::thread std::thread is a class that encapsulates multithreading APIs of the operating system. Different operating systems has different API functions. For exampl...

Important Features in C++11

What you must know about C++11

Important Features in C++11 So far, we have already learnt most of the commonly used C++ features. Many of them are introduced in C++11 standard. Here we sum up a list of some important features i...

More about Lambda Expressions

Simple and powerful anonymous functions

More about Lambda Expressions Function objects are powerful, but every time we use a function object we need to define a class for it, which has a poor flexibility. In many cases we don’t want to ...

std::bind() - A Simple Thread Pool

Implement a simple thread pool with std::bind()

std::bind(): A Simple Thread Pool In previous chapter, we have introduced bind1st and bind2nd. These binders are used to bind function parameters with fixed value. However, they only apply to func...

More about std::function

Underlying implementation of std::function

More about std::function std::function can be used to bind a function into a function object. Then corresponding functions can be called through function objects. void foo(string str) { cout ...

Template Specialization and Argument Deduction

More advanced techniques about templates

Template Specialization and Argument Deduction Before exploring the underlying implementation of std::function, there are a couple of things that need to be illustrated about templates. In previo...

Introduction to std::function

A powerful class to bind a function with a function object

Introduction to std::function std::function is a powerful class in C++ 11 which is able to bind a function with a function object. To use it we need to include the functional library: #include &...

More about Binders

Underlying implementation of bind1st and bind2nd

More about Binders In previous chapter we briefly introduced binders and how they can be used in generic algorithms. With binders, we can convert a binary function object into a unitary function o...

Custom Deleters

Custom resource release for smart pointers

Custom Deleters Smart pointers ensure the automatic release of resources on the heap. In the previous example, our custom SmartPtr release the resources by calling delete on the pointer. However, ...

Smart Pointers with Reference Counting

shared_ptr and weak_ptr

Smart Pointers with Reference Counting When using auto_ptr, scoped_ptr and unique_ptr, there can only be one pointer that manages the object at the same time. But with reference counting, multiple...