|
You are here |
mklimenko.github.io | ||
| | | | |
nelari.us
|
|
| | | | | A small look at some useful template techniques, in the context of trying to bind functions to a virtual machine. I wrote this post mostly for myself so that these techniques would be listed all in one place. | |
| | | | |
www.foonathan.net
|
|
| | | | | Just like regular function parameters, template parameters can also have default parameters. For class templates, this behaves mostly just like default function arguments: if you pass fewer template arguments than required, default template arguments are used to fill the remaining places. However, for function templates, it gets more complicated as template parameters for functions can be deduced by the normal function arguments. This leads to some interesting side-effects. In particular, default argumen... | |
| | | | |
rodusek.com
|
|
| | | | | Getting the name of a type in C++ is a hassle. For something that should be trivially known by the compiler at compile-time, the closest thing we have to getting the type in a cross-platform way is to use std::type_info::name which is neither at compile-time, nor is it guaranteed to be human-readable. In fact, both GCC and Clang actually return the compiler's mangled name rather than the human-readable name we are used to. Let's try to make something better using the modern utilities from c++17 and a little creative problem solving! | |
| | | | |
cppstories.com
|
|
| | | Let's say we have the following code: LegacyList* pMyList = new LegacyList(); ... pMyList->ReleaseElements(); delete pMyList; In order to fully delete an object we need to do some additional action. How to make it more C++11? How to use unique_ptr or shared_ptr here? Intro We all know that smart pointers are really nice things and we should be using them instead of raw new and delete. | ||