Videos from C++Now are available!
Videos of the keynotes and sessions from C++Now 2013, held in May are now available.
They are available on YouTube.
June 16-21, Sofia, Bulgaria
September 13-19, Aurora, CO, USA
October 25, Pavia, Italy
November 6-8, Berlin, Germany
November 16-21, Kona, HI, USA
By marshall | Jun 27, 2013 09:54 AM | Tags: intermediate experimental advanced
Videos of the keynotes and sessions from C++Now 2013, held in May are now available.
They are available on YouTube.
By Blog Staff | Jun 26, 2013 09:37 AM | Tags: intermediate
New at InformIT:
C++11 Regular-Expression Library
by Brian Overland
From the article:
Regular expressions are of practical value in many programs, as they can aid with the task of lexical analysis—intelligently breaking up pieces of an input string—as well as tasks such as converting from one text-file format (such as HTML) to another.
I’ve found that when the C++11 regular expression library is explained in a straightforward, simple manner, it’s easy to use. This chapter doesn’t describe all the endless variations on the regex function-call syntax, but it does explain all the basic functionality: how to do just about anything you’d want to do.
By Mantosh Kumar | Jun 23, 2013 01:56 PM | Tags: stepanov performance intermediate efficiency components advanced
A wonderful video series by the inventor of the Standard Template Library (STL).
Video Series: Efficient Programming with Components
by Alexander Stepanov
Performance is essential for infrastructure software. Modern infrastructure software depends heavily on components. Therefore, writing performant code in this environment requires deep understanding of the characteristics of such components. The course will help programmers to improve performance of their code by learning how to use these existing generic components effectively. In addition, it will teach them to extend the library with new high-performance components. Along the way, participants will learn how to use C++ as a high-performance language.The course will be taught interactively with the class discussing, discovering, and developing components together.
By Blog Staff | Jun 23, 2013 10:04 AM | Tags: scalability parallel intermediate cores advanced
From the recent BoostCon/C++Now event. If you missed it there, check it out online. An updated version of this talk is also slated for the upcoming Meeting C++ this fall if you want to catch it in person.
Scaling with C++11
Edouard Alligand
As the number of cores per processor increases, software needs to be able to execute multiple tasks in parallel in order to benefit from Moore's law. This is not only a question of writing parallel algorithms, but also a matter of designing the application properly to reduce inter-thread dependencies. These dependencies may be very hard to find and are the results of decades of serial programming. Thus, writing truly scalable software is less a question of technical expertise than adopting the appropriate state of mind.
This presentation is about the design, techniques and tools used by the team who wrote the hyperscalable database "quasardb." Building upon concrete scalability challenges, the presenter will expose typical multithreading anti-patterns and how to avoid them. The topics covered include: atomics, micro locks, lock-free and wait-free containers, memory management strategies (copy on write, smart pointers, perfect forwarding...), thread local storage, asynchronous I/O, and much more!
By Blog Staff | Jun 22, 2013 09:11 AM | Tags: move intermediate
Fresh at Dr. Dobb's:
More Thoughts About Moving Objects Safely
by Andrew Koenig
Moving objects instead of copying them is a tricky notion to explain — and perhaps trickier than I realized.
By Blog Staff | Jun 21, 2013 03:01 PM | Tags: intermediate c++14
Hot off the press:
“constexpr” function is not “const”
by Andrzej Krzemieński
From the article:
This is just a word of caution. C++14 will not be backwards compatible with C++11 in one aspect of
constexpr
functions.
By Blog Staff | Jun 21, 2013 01:52 PM | Tags: intermediate explicit conversions basics
Tales of C++, Episode 5:
Explicit Is Better Than Implicit
The Zen of Python tell us that Explicit is better than Implicit. This is good advice for any and all languages, but what are the implications in the C++ lands? There is one particular C++ feature that relates directly to that advice; one important enough that grants on its own the introduction of a keyword. That feature is user-defined conversions and that keyword is
explicit
.
By Blog Staff | Jun 19, 2013 03:35 PM | Tags: intermediate
Quick A: No. You're capturing "this" by value, which is a pointer, which effectively captures members by reference.
From StackOverflow:
Lambda captures and member variables
I was watching Herb Sutter's talk at the C++ and Beyond 2012 conference on Concurrency and he talks about creating a non-blocking wrapper class, which he calls
concurrent<T>
, with C++11 functions.His implementation is fairly simple (aside from needing a
concurrent_queue
such as that which exists in Microsoft's PPL):template <class T> class concurrent { private: mutable T t; mutable concurrent_queue<std::function<void()>> q; bool done = false; std::thread thread; public: concurrent( T t_ = T{} ) : t{t_}, thread{ [=]{ while( !done ) q.pop()(); }} {} ~concurrent() { q.push( [=]{ done = true; } ); thread.join(); } template <typename F> void operator()( F f ) const { q.push( [=]{ f(t); } ); } };This seems simple enough, however, I'm confused as to why he has captured the member variables
done
andq
by value instead of by reference? My understanding is that if they are captured by value then they will be copied to the thread and thus when the queue is updated the worker thread will not receive the updates?Have I misunderstood how lambda captures work with regards to class member variables? No one said anything in the comments to the video or during the talk so I am assuming that my understanding is faulty, in which case could someone please clarify?
By Blog Staff | Jun 14, 2013 04:43 PM | Tags: intermediate
New at InformIT:
Regular Expressions 101: Regex in C++11
by Brian Overland
From the article:
... You don't really need to know how it works. In fact, you only need to know a few things:
- The regular expression grammar used by the C++11
regex
library functions- The relevant C++11 functions and how to call them
The first part of this article focuses on the default
regex
grammar used in C++11: the ECMAScript grammar. You'll generally want to use ECMAScript, because it provides powerful capabilities while being easy to use. For simplicity, I'll focus on this grammar. ...
By Blog Staff | Jun 14, 2013 04:36 PM | Tags: intermediate basics
The solution to the latest GotW problem is now available:
GotW #93 Solution: Auto Variables, Part 2
by Herb Sutter
From the article:
As you worked through these cases, perhaps you noticed a pattern: The cases are mostly very different, but what they have in common is that they illustrate reason after reason motivating why (and how) to use
auto
to declare variables.Let’s dig in and see...