You are here |
cppstories.com | ||
| | | |
www.cppstories.com
|
|
| | | | What do you do when the code for a variable initialization is complicated? Do you move it to another method or write inside the current scope? In this blog post, I'd like to present a trick that allows computing a value for a variable, even a const variable, with a compact notation. | |
| | | |
www.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. | |
| | | |
www.cppstories.com
|
|
| | | | Variadic Templates from C++11 is probably not a feature that you use on a daily basis. But recently, I've come across one refactoring example where I've decided to give a try and apply variadics. Intro When I was doing some work in some old UI code I've noticed several similar lines of code that looked like that: | |
| | | |
donsbot.com
|
|
| | A common misconception from non-Haskellers is that Haskell, when compiled, pays an ongoing penalty for supporting laziness by default. The idea is that in a lazy language, every expression would suspend to a heap-allocated, garbage collected, thunk. Even if you were to use the variable immediately. That sounds scarily expensive. In the real world however,... |