Libc++ C++1Y/C++14 status page is now available
Libc++ now has a status page for the C++1Y/C++14 implementation. You can follow along here to see when your favorite features are implemented:
libc++ C++1Y status
October 25, Pavia, Italy
November 6-8, Berlin, Germany
November 3-8, Kona, HI, USA
By marshall | Aug 13, 2013 11:31 AM | Tags: None
Libc++ now has a status page for the C++1Y/C++14 implementation. You can follow along here to see when your favorite features are implemented:
libc++ C++1Y status
By Blog Staff | Aug 12, 2013 04:00 PM | Tags: None
New on Code Project:
Open Multi-Methods for C++11, Part 1
by Jean-Louis Leroy
Note: We recommend first reading this C++ multimethods paper coauthored by Bjarne Stroustrup for more background.
From the article:
This article is the first in a series about open multi-methods for C++11. In this installment, I will explain what they are, how they fit in the object-oriented paradigm, and make controversial statements.
Subsequent articles will present a new library that implements open multi-methods, using the facilities provided by C++11 (in particular, variadic templates). The library's salient features are: fast, constant time dispatch using compact tables; arbitrary number of virtual and non virtual arguments; access to the next most specific specialization; and support for shared libraries and dynamic loading. The series will conclude with an in-depth presentation of the internals of the library. ...
By Blog Staff | Aug 9, 2013 01:27 AM | Tags: None
From the desk of ARK:
Some Optimizations Are More Important Than Others
by Andrew Koenig
From the article:
[...] In short, the key to finding effective ways to speed up a program is to look at the parts of the program that dominate its execution time and find ways of speeding up those parts that require relatively little programmer effort to implement.
With this background in mind, let's think about moving data rather than copying it. Suppose, for example, that we have two functions, each of which takes a
stringargument: ...
By Blog Staff | Aug 8, 2013 01:21 PM | Tags: intermediate
This open source REST SDK also supports Linux...
C++ REST SDK in Visual Studio 2013
by Marius Bancila
From the article:
The C++ REST project provides a modern asynchronous C++ API for cloud-based client-server communication. ...
The following example shows how to retrieve and display some JSON content....
By Blog Staff | Aug 8, 2013 07:41 AM | Tags: advanced
The "universal references" term is getting traction:
Universal References and the Copy Constructor
by Eric Niebler
From the article:
At the most recent NWCPP meeting in Redmond, WA, the always-entertaining Scott Meyers shared his latest insights about so-called “universal references” and their pitfalls. In particular, he was warning about the hazards of overloading on universal references. His advice was good, I thought, but missed some important corner cases about the interactions between universal references and the special member functions. In this article, I show what the “special” problems are with the special member functions and universal references, and some ways to avoid the problems. ...
...
Scott’s advice is simple and sound: avoid overloading on universal references. By which he means, don’t do this:template<typename T> void foo( T const & t ) {/*...*/} template<typename T> void foo( T && t ) {/*...*/}In the code above, the author presumably wanted all lvalues to go to the first and all rvalues to go to the second. But that’s not what happens. What happens is this: ...
By Blog Staff | Aug 7, 2013 03:49 PM | Tags: intermediate
Quick A: Here are two hints...
array<string>.array<unique_ptr<X>>.Today on SO:
Should std::array have move constructor?
Moving can't be implemented efficiently (O(1)) on
std::array, so why does it have move constructor?
By Blog Staff | Aug 7, 2013 07:08 AM | Tags: None
Bjarne Stroustrup spoke at this summer's ACM International Collegiate Programming Contest World Finals held in St. Petersburg, Russia. While there, he also gave this 8-minute interview in the context of balancing efficient code with the out-of-the-box problem solving required by ICPC problem challenges.
2013 ICPC Bjarne Stroustrup
C++ inventor Bjarne Stroustrup discusses the relationship of programming languages and competition and the benefit of participating in events such as the ACM-ICPC.
By Blog Staff | Aug 6, 2013 08:56 AM | Tags: None
A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.
Document number: N3707
Date: 2013-08-06
2014-02 Meeting Invitation and Information
by Herb Sutter
Excerpt:
The winter 2014 meeting of WG21 is being hosted by Microsoft and will be held on February 10-15, 2014 at Hilton Garden Inn, 1800 NW Gilman Blvd., Issaquah, Washington, USA 98027
By Blog Staff | Aug 5, 2013 11:04 AM | Tags: intermediate
Inquiring minds want to know:
Why does C++0x's lambda require “mutable” keyword for capture-by-value, by default?
Short example:
#include <iostream> int main() { int n; [&](){n = 10;}(); // OK [=]() mutable {n = 20;}(); // OK // [=](){n = 10;}(); // Error: a by-value capture cannot be modified in a non-mutable lambda std::cout << n << "\n"; // "10" }The question: Why do we need the
mutablekeyword? It's quite different from traditional parameter passing to named functions. What's the rationale behind?I was under the impression that the whole point of capture-by-value is to allow the user to change the temporary -- otherwise I'm almost always better off using capture-by-reference, aren't I?
Any enlightenments?
(I'm using MSVC2010 by the way. AFAIK this should be standard)
By Blog Staff | Aug 4, 2013 09:19 PM | Tags: intermediate
This question is an oldie but goodie. Note that in C++11 some of this becomes clearer, because it's now recommended to use constexpr and using template aliases instead of "traits" styles, and traits are one of the bigger (but not only) reasons to have a template refer to another template.
Where and why do I have to put the “template” and “typename” keywords?
In templates, where and why do I have to put
typenameandtemplateon dependent names? What exactly are dependent names anyway? I have the following code: ...