basics

To Be or Not to Be (an Iterator) -- Eric Niebler

Eric Niebler gives in his recent blog post insights about iterators

To Be or Not To Be (an Iterator)

by Eric Niebler

From the article:

Way back in 1999, when the ink on the first C++ standard was still damp, Herb Sutter posed a GoTW puzzler in the still extant C++ Report (RIP): When Is a Container Not a Container? In that article, Herb described the problems of the now-infamous vector<bool>. According to the standard’s own container requirements, vector<bool> is not a container.

In a nutshell, it’s because vector<bool>‘s iterators claim to be random-access, but they’re not. Random-access iterators, when you dereference them, must return a real reference. They can only do that if the thing they point to really exists somewhere. But the bool that a vector<bool>::iterator points to does not exist anywhere. It’s actually a bit in a packed integer, and dereferencing a vector<bool>‘s iterator returns an object of some type that merely acts like a bool& without actually being a bool&.

A Casting Show -- Arne Metz

In this next article Arne Mertz describes different type casts.

A Casting Show

by Arne Mertz

From the article:

In C++ there are two ways of type conversions: implicit and explicit type conversions. The latter are called type casts and they are what this post is about.

Testdriven C++ with Catch

A new video from Meeting C++ 2014:

Testdriven C++ with Catch

by Phil Nash

From the talk description:

C++ has been notorious for being a second class citizen when it comes to test frameworks. There are plenty of them but they tend to be fiddly to set-up and ceremonious to use. Many of them attempt to follow the xUnit template without respect for the language environment they are written for. Catch is an attempt to cut through all of that...

Don’t Try Too Hard! – Exception Handling -- Arne Mertz

Arne Mertz describes in his recent article insights about exception handling.

Don’t Try Too Hard! – Exception Handling

by Arne Mertz

From the article:

Among C++ developers there often appears to be a misconception about what it means to deal with code that can throw exceptions. The misconception is that the possibility of exceptions means one has to try and catch often and almost everywhere. I will try to explain why I think that is wrong and where I think try/catch is appropriate and where not.

C++11 library components to make a programming scientist happy

A new video from Meeting C++ 2014:

C++11 library components to make a programming scientist happy

by Peter Gottschling

From the talk description:

This talk presents a survey over components of the C++11
standard library which facilitate the life of a programming scientist.
It will provide a gentle introduction to the random number generator
and evolve this to a complete application: the stochastic simulation
of share price development.

Operator Overloading -- Arne Mertz

Arne Mertz describes in a series of articles the principles of operator overloading.

Operator Overloading

Operator Overloading: Common Practice

by Arne Mertz

From the articles:

Operators can be used to make user defined classes act like known types, e.g. like numbers, pointers and iterators. That way they facilitate the usage of those classes. They can also be used to make your objects do whatever you want them to do, for example build structures that save the operations for later evaluation. The latter is especially useful for building embedded DSLs and gives enough subject matter for a whole series of blog posts. [The first] post will cover the former use of operator overloading, i.e. writing operators that behave like “normal” operators.

... In [the second] post I will go into the details and write a bit about each operator and how a straight forward implementation might look if the operator is meant to work similar to built in operators.

 

C++ in 2015

My yearly overview on the things that might come:

C++ in 2015

by Jens Weller

From the article:

The year is still young, so lets have an outlook about what is going to happen in C++ Land in 2015...

C++ User Group Meetings in January

A new year, and many more user groups? In January there are already 18 planned meetings:

C++ User Group Meetings in January 2015

by Jens Weller

The Meeting List:

7.1 C++ UG Saint Louis - Deep Dive - Part 1
7.1 C++ UG Santa Barbara - Boost Units
8.1 C++ UG NRW/Aachen - Open Source mit Schwerpunkt C++
8.1 C++ UG Dresden - OpenFoam
14.1 C++ UG Utah - Group Exercism.io in C++
14.1 C++ UG San Francisco/ Bay area - Presentation and Q&A
15.1 C++ UG Madrid - De 0 a 100 (Taller)
15.1 C++ UG Hamburg - Mandelbrot mit MPI
19.1 C++ UG Denver - Denver Tech Center C++ Developers
19.1 C++ UG Austin - North Austin Monthly C/C++ Pub Social
19.1 C++ UG Juce - JUCE C++ Meetup San Francisco
20.1 C++ UG Chicago - CUDA
20.1 C++ UG Juce - JUCE C++ Meetup Los Angeles
21.1 C++ UG Bristol - Save the date
21.1 C++ UG Düsseldorf - Treffen der C++ User Gruppe NRW
22.1 C++ UG Rhein-Neckar - Summary of Meeting C++ Conference and Coding Dojo
22.1 C++ UG Munich - Expression Templates Revisited
28.1 C++ UG San Francisco/ Bay area - Workshop and Discussion Group

 

Let's play a game: Spot the bug in popular open-source projects -- Andrey Karpov

[We don't often link to quiz-like sites, particularly product-specific ones, but in this case we felt that this could be of broad interest to some of our readers. -- Ed.]

 

The authors of the PVS-Studio analyzer invite you to test your attentiveness:

Let's play a game -- spot the bug in popular open-source projects

by Andrey Karpov

From the article:

Code analyzers never get tired and can find errors a human's eye cannot easily notice. We have picked a few code fragments with errors revealed by PVS-Studio, all the fragments taken from well-known open-source projects.

We invite you to take part in a competition against code analyzers to test your agility by trying to find the errors by yourself. You will be offered 15 randomly selected tasks. Every correct answer earns you one score if you give it within 60 seconds. The code fragments are short and 60 seconds is a fair limit.

Let's examine a couple of examples with errors for you to understand how to give the answer...

Note: This test does not currently support mobile devices. We are working on new version of tests with better mobile devices support, new problems to solve etc. However, it is not implemented yet. We offer you to subscribe on twitter to read about our new and interesting news and to read about new things in a C++ world.