When talking about
T&& in C++, you may have heard about universal references and forwarding references. This may get you wonder. Why there are two names for an apparently same concept? Is there any difference between them? Which one should I use? Let’s find out.
Have you ever wondered which of the following variants you should use in range-based for loops and when?
const auto&&, or
decltype(auto)? This post tries to present rules of thumb that you can use in day-to-day coding. As you will see, only four of these variants are generally useful.
Since C++11, one can put the initialization of data members directly into structure or class definition. However, this change has consequences with regards to the construction of such structures. Indeed, by adding member initializers into a structure may render your previously working code non-compilable. In the present post, I describe this change, the related issues, and explain how to get around them.
There are many projects written in C++98. Moreover, lots of programmers are still used to C++98. However, with the standardization of C++11 and C++14, C++98 is becoming obsolete. In this post, I would like to list some of the features of C++11 that can be used to improve C++98 code in situations where it is possible to use the new standard.
This month, a new book from one of the foremost C++ experts Scott Meyers became available: Effective Modern C++, subtitled 42 Specific Ways to Improve Your Use of C++11 and C++14. The present post gives my humble review of this jewel.
In this post, we will see a way of implementing a list in Python that can be indexed with an integer or string representing the
name attribute of a stored object.
Today, I have finished the implementation of a new open-source bencoding library. It is named cpp-bencoding and written in C++11. In the present blog post, I would like to briefly introduce it.
Sometimes, you need to unit-test functions that call functions from the standard library that rely on side effects. In this post, I show a way of doing so in Python with
unittest.mock.patch(). More specifically, we implement two context managers that use
os.chdir() to perform actions in the given directory, and show a way of unit-testing them without relying on the file system.
Sometimes, you may wish to check within a script when a configuration file or the script itself changes, and if so, then automatically restart the script. In this post, you will see a way of doing this in Python.