CppCon 2014: Arthur O'Dwyer 'C++11 in the Wild: Techniques from a Real Codebase'

preview_player
Показать описание

--
This talk presents several reusable constructs from a production C++11 codebase, each of which would not be possible without C++11's new features. Auto() is what Alexandrescu's ScopeGuard looks like after a dozen years of C++ evolution. make_iterable() constructs a container from a pair of iterators, enabling simple "foreach" iteration over legacy containers. spaceship() is an efficient "strcmp" for tuples. Time permitting, we'll look at some more arcane code samples.
--
Arthur O'Dwyer worked for many years at Green Hills Software, making the world's most optimizing C and C++ compilers. Until recently he worked at MemSQL, making the world's fastest distributed SQL database.
--

*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

Considering how many questions he takes it's really sad that he doesn't repeat any of them.

TheCreat
Автор

Regarding the #pragma once, beware that it had (has?) quite trouble if the header file is duplicated across network shares (mounts), Windows substituted drives, symlinked or hardlinked (possibly under different names). There was a well known bug in GCC regarding this issue, and I'm not really sure, if:
a) all C++ compilers in the world support #pragma once, and
b) all behave the exact same when it comes to duplication over network and links. That's the reason I prefer to use the #ifdef guards.

emilmaskovsky
Автор

At the end, "You will run out of memory"

While you might run out of address space if you accept unconstrained input parameters, but to say you'll run virtual memory isn't entirely accurate: unless you write to it, virtual memory is just that, 'virtual'. It's 2014 and all operating systems only allocate a physical after a write.

If you want [contiguous, ] reserved, physical memory... don't use C++

mmelt
Автор

I like the #pragma once too. I always have shuddered when i see include guards, are the include guard symbols really used anywhere else, why define a new symbol just to make the include idempotent

thought