Articles & Books

C++ Templates series -- Feabhas

Here's a recent series that just got a new instalment today: It introduces template basics in a nicely explained and accessible way suitable for a gentle introduction, and then going on to progressively help the reader develop stronger template muscles.

C++ Templates series

by Feabhas

An Introduction to C++ Templates

Template Classes

Template Inheritance

Templates and Polymorphism

Template Member Functions

Variadic Templates

Templates of Templates

And today: Template Specialization

From the Introduction:

Templates are a very powerful -- but often very confusing -- mechanism within C++. However, approached in stages, templates can be readily understood (despite their heinous syntax).

The aim of this series of articles is to guide beginners through the syntax and semantics of the foundation concepts in C++ template programming.

atoi and itoa conversions in C++11 -- FangLu

All your friends know about C++11's new stoi and to_string, right? If not, here's a quick refresher to share:

atoi and itoa conversions in C++11

by FangLu

The key reminder from the article:

... The atoi and itoa conversions in C are not very satisfying to programmers, because programmers need to deal with invalid input and exceptions to avoid worst case. On the other hand, these functions are straightforward and easy to use. So they are not rare in C++ code...

In C++11, global functions, such as std::to_string, std::stoi/stol/stoll are introduced to implement atoi/itoa conversions conveniently. For example:

string s;

s += to_string(12) + " is int, ";

s += to_string(3.14f) + " is float.";

cout << s << endl;

where to_string can do type conversion according to the parameter type.

Here is another example:

string s("12");

int i = stoi(s);

cout << i << endl;

Fun with Lambdas: C++14 Style (Part 3) -- Sumant Tambe

sumant-tambe.PNGMore rapid-fire "now write this using lambdas" problem-solution drill with Sumant Tambe:

Fun with Lambdas: C++14 Style (Part 3)

by Sumant Tambe

From the article:

Now that we have C++14, it has opened up doors for truly mind-bending uses of lambdas--more specifically--generic lambdas. This blog post is the third installment in the series of "Fun with Lambdas: C++14 Style". Check out part 1 and part 2 if you have not already.

This post is about "monadic tuples"...

Journey to the Alps: Participating in the C++ Standardization Process

Recently on the Spot blog:

Trip Report: Journey to the Alps -- Participating in the C++ Standardization Process

by Nathan Wilson

From the article:

... At Spot Trading, we currently utilize many of the C++11 features -- lambdas, keyword auto, nullptr, move operations, constexpr, range based for loops, explicit overrides, atomic operations, threading, futures, and new pointer types. Bjarne Stroustrup has said that we want to be able to continue to make simple things simple. These features of the language, mentioned above, certainly do that...

Demystifying C++ lambdas -- Feabhas

In case you missed it:

Demystifying C++ lambdas

by Feabhas

From the article:

Lambdas are one of the new features added to C++ and seem to cause considerable consternation amongst many programmers. In this article we’ll have a look at the syntax and underlying implementation of lambdas to try and put them into some sort of context.

C++14 Is Out! -- Jose Daniel GarcĂ­a

A view from our primary ISO representative from Spain, commenting on C++14's approval one week ago and providing a nice set of highlights showing what's new.

C++14 Is Out!

Jose Daniel García 

From the article:

After the long process that took a decade to produce C++11, the standards committee tried to define a more streamlined process to deliver updates and new versions of the C++ language and its standard library more frequently. The first target was to produce a new version for 2014. Now we can say that we have achieved the milestone.

... So, what’s new in C++14? In the language itself you will find a bunch of new/improved features. If you ask which is the most relevant new feature, the most common answer you may get is “generic lambdas”...

Near-final version of Effective Modern C++ available -- Scott Meyers

Scott's long-awaited book on using C++11 and C++14 is nearing completion:

Near-Final Draft of Effective Modern C++ Now Available (plus TOC and sample Item)

by Scott Meyers

From the announcement:

Effective Modern C++ is moving closer and closer to reality. This post contains:

  •     Information about availability of an almost-final draft of the book.
  •     The current (and probably final) table of contents.
  •     A link to the I-hope-I-got-it-right-this-time version of my Item on noexcept.

Note: Scott's session at CppCon ("Type Deduction and Why You Care") is based on the first chapter of Effective Modern C++.

Slashdot AMA responses from Bjarne Stroustrup

Hot off the presses, Stroustrup's answers to the most-upvoted questions (and a few more) from last week's AMA question thread.

Interviews: Bjarne Stroustrup Answers Your Questions 

Last week you had a chance to ask Bjarne Stroustrup about programming and C++. Below you'll find his answers to those questions. If you didn't get a chance to ask him a question, or want to clarify something he said, don't forget he's doing a live Google + Q & A today at 12:30pm Eastern. 

And don't forget that said live Q&A session starts in 20 minutes...

auto considered awesome -- Jarryd Beck

Today's op-ed from our Australian correspondent:

auto considered awesome

by Jarryd Beck

From the article:

 

My last post about why you might not want to use auto may have left some people thinking that I think you shouldn’t use it. In fact I think you should almost always use it...