CopperSpice: Lambdas in C++

New video on the CopperSpice YouTube Channel:

Lambdas in C++

by Barbara Geller and Ansel Sermersheim

About the video:

In this video, we cover an introduction to C++ lambdas, how they differ from function pointers and functors, and why the term functor should really be avoided. We also give a brief overview of how lambdas have been extended since they were introduced in C++11.

Please take a look and remember to subscribe!

Without form and void--Barry Revzin

Did you encounter the problem?

Without form and void

by Barry Revzin

From the article:

In C++, void is a pretty strange thing. We can cast expressions to void, throw-expressions have void type, void* can point to anything, and void functions can actually return back to the caller. But we can’t have objects of type void or even write a type like void&. A function declaration like void f(void) is actually a nullary function. It’s a bit weird — but it’s not something a lot of people lose sleep over.

Until it starts wreaking havoc on your generic code — because it’s like the vector<bool> of the type system...

[[trivial_abi]] 101--Arthur O’Dwyer

Interesting!

[[trivial_abi]] 101

by Arthur O’Dwyer

From the article:

Finally, a blog post on [[trivial_abi]]!

This is a brand-new feature in Clang trunk, new as of about February 2018. It is a vendor extension to the C++ language — it is not standard C++, it isn’t supported by GCC trunk, and there is no active WG21 proposal to add it to the standard C++ language, as far as I know...

Submission Reminder--cppcon

Don't forget.

Submission Reminder

by cppcon

From the article:

The deadline for session submissions is only days away. Review the Call for Submissions and make your submission soon. You can run your ideas by the Submission Advice mailing list, but you must hurry for this. The advice list gets very busy as the deadline draws near...

CppCast Episode 148: C++ Simplicity with Kate Gregory

Episode 148 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Kate Gregory to discuss her recent talk at ACCU, Pluralsight courses and the new include C++ community.

CppCast Episode 148: C++ Simplicity with Kate Gregory

by Rob Irving and Jason Turner

About the interviewee:

Kate Gregory has been using C++ since before Microsoft had a C++ compiler, and has been paid to program since 1979. She loves C++ and believes that software should make our lives easier. That includes making the lives of developers easier! She'll stay up late arguing about deterministic destruction or how C++ these days is not the C++ you remember.

Kate runs a small consulting firm in rural Ontario and provides mentoring and management consultant services, as well as writing code every week. She has spoken all over the world, written over a dozen books, and helped thousands of developers to be better at what they do. Kate is a Microsoft Regional Director, a Visual C++ MVP, an Imagine Cup judge and mentor, and an active contributor to StackOverflow and other StackExchange sites. She develops courses for Pluralsight, primarily on C++ and Visual Studio. Since 2014 she was Open Content Chair for CppCon, the largest C++ conference ever held, where she also delivered sessions.

"Modern C++ Template Programming" with Nicolai Josuttis

Meeting C++ 2018 offers also a workshop with Nicolai Josuttis:

Modern C++ Template Programming

by Jens Weller

From the article:

Each and every C++ programmer uses templates. Containers such as vector<> or array<>, strings, algorithms such as sort(), iterators, and I/O streams are all implemented as generic code. Modern C++ adds type traits, smart pointers, and template member functions such as emplace(), and generic lambdas as a tricky form of generic code.

Nevertheless the knowledge and understanding of how to implement and use templates is very limited and each and every programmer is sooner or later getting uncertain.

This workshop therefore discusses templates for a whole day to make clear what it means to use templates and how to use them in practice. As a result the general understanding of templates will be improved and generic code might become more helpful and less surprising.

When to Use Enums and When to Use Tag Dispatching in C++--Jonathan Boccara

What is your preference?

When to Use Enums and When to Use Tag Dispatching in C++

by Jonathan Boccara

From the article:

Enums and tag dispatching are two ways to introduce several behaviours in the same interface in C++. With them, we can pass arguments that determine a facet of how we want a function to behave.

Even if enums and tag dispatching have that in common, they achieve it in a quite different way. Realizing what these differences are will give you tools to decide which one to use in any given situation...

Your handy cut-out-and-keep guide to std::forward and std::move--Glennan Carnie

Do you know it?

Your handy cut-out-and-keep guide to std::forward and std::move

by Glennan Carnie

From the article:

I love a good ‘quadrant’ diagram.  It brings me immense joy if I can encapsulate some wisdom, guideline or rule-of-thumb in a simple four-quadrant picture.

This time it’s the when-and-where of std::move and std::forward.  In my experience, when programmers are first introduced to move semantics, their biggest struggle is to know when (or when not) to apply std::move or std::forward.  Usually, it’s a case of “keep apply std::move until it compiles”.  I’ve been there myself.

To that end I’ve put together a couple of a simple overview quadrant graphics to help out the neophyte ‘mover-forwarder’.  The aim is to capture some simple rules-of-thumb in an easy-to-digest format...

Exceptional exploration (2) -- Lucian Radu Teodorescu

Are you exceptionally curious?

Exceptional exploration (2)

by Lucian Radu Teodorescu

From the article:

To use or not to use exceptions? That is the question. Asked again.

In the previous post we explored the performance implications of various error handling mechanisms. Here we continue our exploration of error handling mechanisms but focusing on modifiability – i.e., the ability of the code to be easy to write and be modified in the future.

We argue that exceptions are both a good thing and a bad thing. We attempt to divide the scenarios into multiple categories, and we provide reasons pro and con for each category. The goal is to find the contexts in which it’s better to use exceptions. The answer may be surprising: there are more cases in which manual error handling is better than using exceptions. If only standard library would support non-exception policies…