Tag Archives: c++11

Eric Niebler: out parameters, move semantics, and stateful algorithms This post from Eric, inspired by a prompt from Andrei Alexcandrescu, examines the interface of std::getline appraising its usability and performance. Eric looks at a few different designs, in particular those … Continue reading

Link | Posted on by | Tagged , , , , , , | Leave a comment

Boost compile error “no class template named ‘result’”

I’ve just come across a compiler error resulting from using boost::result_of with a C++11 lambda. I wasn’t actually using boost::result_of directly, but provided a lambda as the transforming functor for a boost::transform_iterator, which uses it behind the scenes. Here’s a … Continue reading

Posted in Uncategorized | Tagged , , , | 1 Comment

Adventures in lock-free programming

I’ve been intrigued by the idea of lock-free programming since I discovered that C++0x (as it was then) was to gain library facilities for standardised, portable lock-free programming. The new <atomic> header enables us to perform atomic reads and writes … Continue reading

Posted in Uncategorized | Tagged , , , , , | Leave a comment

Eric Niebler: stupid name lookup Eric Niebler shows a name lookup failure caused by a recursive template function inferring its return type via decltype. Stupid problem with a rather nasty hacky workaround, but also a likely change in C++14 that … Continue reading

Link | Posted on by | Tagged , , , , | Leave a comment

Using the standard allocator for a different type [and get free functionality for your custom allocator]

Someone on comp.lang.c++.moderated recently asked “if I have a different allocator, can I use that allocator to allocate memory with vector or string…?”. Since there is not only the mechanism supported by C++98/03, but also a more general – and … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Generalised type-deduction for class template instance construction

I’ll wager that most C++ developers with experience of templates have at some point discovered the limitation that a class template’s parameters cannot be deduced in construction. Since type deduction can be performed in invocation of a function template however, I … Continue reading

Posted in Uncategorized | Tagged , , , , | Leave a comment

Efficient argument passing in c++11 [via A Sense of Design]

Boris Kolpackov has written a series of 3 articles on the minefield of efficient argument passing in C++11. In part 1 he discusses the addition to C++11 – rvalue references – that improves argument-passing efficiency in some cases, but that … Continue reading

Posted in Uncategorized | Tagged , | Leave a comment