November 2013

Concept Checking in C++11 -- Eric Niebler

While we're waiting for Concepts Lite, Eric shows how we can already do quite a bit in C++11 while planning for a transition to language support when it's available.

Concept Checking in C++11

by Eric Niebler

From the article:

This post describes some utilities I’ve recently developed for doing concept checking in C++11. These utilities are part of an ongoing project to reimplement ranges, also for C++11, but I think the concept checking utilities are useful and interesting in their own right...

Dive into C++11 -- Arkanoid clone in 160 lines of code (SFML2)

arkanoid.PNG

I'm Vittorio Romeo, a computer science student, hobbyist game developer and C++ enthusiast.

I've created a 40 minute tutorial/screencast on the creation of a complete game using C++11 and SFML2. The end result is a playable Arkanoid/Breakout clone with a paddle, a ball and destroyable bricks.

I divided the code in 9 segments, that I analyze and execute individually.

The point of the video is showing how easy it is to create something playable thanks to the C++11 standard, and to show a possible train of thought that can be taken during game development.

I greatly appreciate comments and criticism, and ideas for future videos/tutorials.

Also, feel free to fork the game's source code here: https://github.com/SuperV1234/Tutorials

If the idea catches on, I'd love to make a video featuring the best forks.

Thanks for watching!

Boost Migrating to Git, Going Modular

The historically monolithic Boost project is (finally!) migrating to git, with each library in Boost moving into its own repository on github. The goal is to foster a more agile nimble development model and a more active library ecosystem. Create your own forks, hack, submit pull requests, and do all the good things that distributed version control lets you do. From the announcement on the Boost mailing list:

Subversion repository closing. Conversion to Git imminent.

by Beman Dawes

The Boost Steering Committee has given the final approval for the conversion from Subversion to Git, including the modularization of Boost library repositories.

The Subversion repository will be closed for all changes to all branches, including the sandbox, Sunday, November 23 2013, 00:00 hours UTC. That's 8 PM Saturday, US East Coast time, and 5 PM US West Coast time.

Please make no svn commits after that time. We will be adding a pre-commit hook that prevents commits, but please do not wait for that becomes active.

After svn is closed, the conversion will be run one last time, and then turned off. Then there is a week set aside for final validity checks, testing, and general scurrying around. When that is done, the boostorg repo on GitHub will open for business. If everything goes smoothly, it may take less than a week but if there are glitches it may take longer.

--Beman

Read the full thread here.

Basic Structure of C++ Program -- Prashant Sharma

[Ed.: This is a simple short "hello world" overview for someone starting to program in C++, and is basically correct. There are lots of expert-friendly articles, but we like and want to encourage the beginner- and intermediate-level articles as well for the benefit of the many recent newcomers to the language.]

Basic Structure of C++ Program

The easiest way to understand the basic structure of C++ program is by writing a program. The basic C++ program is as follows: ...

Stroustrup & Sutter on C++: Mar 31 - Apr 1, San Jose, CA, USA

eelive.PNGFor the first time in several years, Bjarne Stroustrup and Herb Sutter will hold a two-day seminar on C++

Super C++ Tutorial: Stroustrup & Sutter on C++

EE Live!
March 31 - April 3, 2014
San Jose, CA, USA

Are you a serious C++ developer? The two-day Super C++ Tutorial, taught by Herb Sutter and Bjarne Stroustrup, the creator of C++, is designed for active C++ developers, embedded systems developers, and anybody who works with the language on a regular basis and wants to write faster, more efficient code for applications ranging from data centers to mobile platforms where all-day battery life is key.

We invite you to spend two insightful and informative days as the instructors present the most important things C++ developers need to know in 2014. The two days are designed to cover a balanced curriculum of information: useful for C++ developers at any level, with helpful information whether you’ve only used C++ for a year or two or are a top C++ guru; balanced between language and standard library topics; covering today’s modern techniques and best practices together with forward-looking information about new features coming and expected to be broadly available in the next year; panels where both speakers share their insights and perspectives with each other and answer your questions; and much more, with the deep context and expertise that these instructors uniquely bring.

Quick Q: Why is std::vector contiguous? -- StackOverflow

Quick A: Because if you're serious about performance, you'll often (not always) use contiguous arrays.

From SO:

Why is std::vector contiguous?

Besides the fact that the standard defines it to be contiguous, why is std::vector contiguous?

If it runs out of space, it needs to reallocate a new block and copy the old block to the new one before continuing.

What if it wasn't contiguous? When the storage fills up, it would just allocate a new block and keep the old block. When accessing through an iterator, it would do simple >, < checks to see which block the index is in and return it. This way it doesnt need to copy the array every time it runs out of space.

Would this really work/be better? or am i missing something?

C++11 Annoyance Avoiders -- Tony DaSilva

A useful short nugget: override FTW!

C++11 Annoyance Avoiders

by Tony DaSilva

From the article:

I’ve always been torn as to whether or not to annotate derived class member functions intended to override base class members as virtual...

Type Erasure, Part 1 -- Andrzej KrzemieĊ„ski

What is this "type erasure" thing you speak of? It's not something at the other end of a pencil (remember those?) but a way to hold an object without knowing its exact type. Andrzej explains:

Type Erasure, Part 1

by Andrzej Krzemieński

From the article:

Have you ever came across term type erasure in C++? This “pattern” or “technique” is growing more and more popular. In this post I will try to describe what it is. Note that it is something different than a similar term in Java.

What does type encode?

Let’s start with describing the opposite of type erasure. We could call such situation “type-full-ness”. Forget the term though, let me illustrate what I mean with an example. ...

Quick Q: Why is there a nonmember begin(), but no nonmember cbegin()? -- StackOverflow

Quick A: There is, in C++14.

From SO:

Is there a way to use standalone std::begin and for a const_iterator?

I like consistency. I recently asked the question of using std::begin vs. e.g. std::vector<int>::begin, and the unanimous decision seemed to be to use the former since it is more general. But I think I found a stick in the mud. Sometimes, you want to convey you will not change a container as you loop through it, hence calling std::vector<int>::cbegin. It would make your code quite asymmetric if you sometimes did iter = v.cbegin() and other times did iter = begin(v). Is there a way around this lack of symmetry, and would you still recommend std::begin given this knowledge? Why does C++ not have std::cbegin?

Core C++ #10 -- Stephan T. Lavavej

core-10.PNGAccompanying today's release of the VC++ CTP, there is a new talk by Stephan T. Lavavej available covering several major C++11 and draft C++14 features that are of likely interest to C++ developers using any compiler.

Core C++, 10 of n (Nov 2013 CTP)

by Stephan T. Lavavej

From the summary:

In part 10, STL explores the new features in the Visual C++ Compiler November 2013 CTP (Community Technology Preview), in addition to the features that were added between VC 2013 Preview and RTM.

Features included in the November CTP ( generic lambdas!!! Smiley ):

C++11, C++14, and C++/CX features:

  • Implicit move special member function generation (thus also completing =default)
  • Reference qualifiers on member functions (a.k.a. "& and && for *this")
  • Thread-safe function local static initialization (a.k.a. "magic statics")
  • Inheriting constructors
  • alignof/alignas
  • __func__
  • Extended sizeof
  • constexpr (except for member functions)
  • noexcept (unconditional)
  • C++14 decltype(auto)
  • C++14 auto function return type deduction
  • C++14 generic lambdas (with explicit lambda capture list)
  • (Proposed for C++17) Resumable functions and await