Here’s a challenge: what’s the longest variable declaration you can come up with?
In this post I’ll show how easy it is to build clang from scratch on Linux, and how to use it both directly and with CMake.
Move Semantics are a C++11 feature which complements C++98’s RVO; Think of them as user-defined RVO-like optimization. While
originally designed to only allow optimizations, one can also utilize move
semantics to limit APIs. This is how std::unique_ptr
is able to be a
move-only type, allowing it to enforce single ownership (more
about std::unique_ptr
here).
Return Value Optimization (RVO), Named RVO (NRVO) and Copy-Elision are in C++ since C++98. In this post I will explain what these concepts mean and how they help improve runtime performance.
In this post I’ll provide a quick tutorial for using libclang. I started playing around with libclang while implementing Reflang – an open source reflection framework for C++. Then I came to appreciate the amazing work done by its developers.
Today we’ll talk about C++’s built-in smart pointer std::shared_ptr
. If you
have not yet read my previous post about std::unique_ptr
I would highly recommend doing so before continuing.
Today we’ll talk about C++’s built-in smart pointer std::unique_ptr
, which is
an extremely powerful, simple & common tool.
Every C++ developer knows that std::string
represents a sequence of characters
in memory. It manages its own memory, and is very intuitive to use.
Today we’ll explore std::string
as defined by the C++ Standard, and also by
looking at 4 major implementations.
Today’s post is about template SFINAE & type-traits - cool C++ features with great compile-time power.
Many libraries provide their users with a way to add user-defined content to the library’s objects. This is especially true for libraries in the graphics domain. Examples:
After exploring std::function
in a previous post, I thought that it might be a good practice to implement a simple (and partial) std::function
. It turned out to be much less code than I anticipated. I hope you’ll like it.
So far in this mini-series we learned how the vtables and typeinfo records are placed in our binaries and how the compiler uses them. Now we’ll understand some of the work the compiler does for us automatically.
In Part 1 and Part 2 of this series we talked about how vtables work in the simplest cases, and then in multiple inheritance. Virtual inheritance complicates things even further.
The world of single-parent inheritance hierarchies is simpler for the compiler. As we saw in Part 1, each child class extends its parent vtable by appending entries for each new virtual method.
In this post we will cover multiple inheritance, which complicates things even when only inheriting from pure-interfaces.
In this mini post-series we’ll explore how clang implements vtables & RTTI. In this part we’ll start with some basic classes and later on cover multiple inheritance and virtual inheritance.
Please note that this mini-series will include some digging into the binary generated for our different pieces of code via gdb. This is somewhat low-level(ish), but I’ll do all the heavy lifting for you. I don’t believe many future posts will be this low-level.
In this post we’ll explore how lambdas behave in different aspects. Then we’ll look into std::function
and how it works.