Daily Shaarli

All links of one day in a single page.

April 18, 2014

C++14 and SDL2: Managing Resources - Eric Scott Barr

C++11 and 14 provide a tool that expresses single ownership of a resource, unique_ptr. When the unique_ptr is deleted, such as when its parent container is destroyed or when it goes out of scope, a custom deleter can be called instead of the delete operator. This behavior is exactly the right mix for managing a resource created by a C library.

An example of a typefree printf with variadic templates: http://en.cppreference.com/w/cpp/language/parameter_pack#Example

Linux /dev/urandom and concurrency