intermediate

5 years of Meeting C++

Meeting C++ exists now for 5 years, lets celebrate on the blog:

5 years of Meeting C++

by Jens Weller

From the article:

Just a little bit more then 5 years ago, Meeting C++ went public. Since then, it has been a wild ride and huge success. Today, Meeting C++ reaches over 50k in social media, the conference it self has grown from 150 to 600 in its 5 editions...

CppCon 2016: Embracing Standard C++ for the Windows Runtime--Kenny Kerr & James McNellis

Have you registered for CppCon 2017 in September? Don’t delay – Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2016 for you to enjoy. Here is today’s feature:

Embracing Standard C++ for the Windows Runtime

by Kenny Kerr & James McNellis

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Believe it or not, avoiding language extensions and embracing modern C++ will make it easier for you to write code for Windows. The Universal Windows Platform in Windows 10 provides the ability for developers to write apps for many devices in many languages. To achieve this goal, it uses the Windows Runtime platform technology to expose functionality from the operating system into languages, including C++. Microsoft wants to make the Windows Runtime naturally and easily available to standard C++ developers. "C++/WinRT" (formerly moderncpp.com) is a standard C++ library and toolset currently under development at Microsoft. It includes a standalone compiler, which converts Windows Runtime metadata into a header-only library. The source code uses standard syntax consumable by any C++ compiler, making it easier for developers to use Windows Runtime APIs from C++.

We will begin this session with the goals of the "C++/WinRT" project. We'll look at the primitives of the Windows Runtime ABI and how this C++ library provides a natural projection of those primitives. We'll look at how C++11 and C++14 language features make it easier to encapsulate the COM infrastructure that underpins the Windows Runtime. Finally, we'll look at how we've optimized the implementation and discuss how a handful of compiler optimizations can make this C++ library efficient and effective for building a wide range of applications.

C++17 in details: Templates--Bartlomiej Filipek

What's new in C++17?

C++17 in details: Templates

by Bartlomiej Filipek

From the article:

Do you work a lot with templates and meta-programming?
With C++17 we get a few nice improvements: some are quite small, but also there are notable features as well! All in all, the additions should significantly improve writing template code.

Today I wrote about:

  • Template argument deduction for class templates
  • template<auto>
  • Fold expressions
  • constexpr if
  • Plus some smaller, detailed improvements/fixes

BTW: if you’re really brave you can still use concepts! They are merged into GCC so you can play with them even before they are finally published.

Why typename?-- Everything Cpp

Why and how do we use typename?

Why typename?

by Everything Cpp

From the video:

Whether you've been using C++ for days or years, misunderstanding the usage of 'typename' can observably lead you through the 5 stages of grief. Unfortunately, all too often, 'acceptance' means just throwing the keyword around until the compiler stops correcting you. Good luck should you need to use the 'template' keyword in a similar fashion.

In this video, we explore just what 'typename' is used for, how you can avoid these errors, and the obnoxious exception to the rule that causes people to doubt their understanding.

Quick Q: When is an rvalue evaluated?

Quick A: When it is assigned.

Recently on SO:

When is an rvalue evaluated?

s2 binds to the expression s1 + s1, but is this evaluated at the time s2 is assigned

Yes.

And also would s2 hold memory for a temporary string?

Precisely, s2 is bound to a temporary std::string.

s1 + s1 will produce a temporary std::string, which will be bound to the reference s2 (and its lifetime is extended to the lifetime of the reference). Then s2 += "Test";, performs operator+=() on  s2, i.e. the temporary std::string.

Better C++ / Chicago July 12-14, 2017

Join us for a 3 day training event in Chicago, IL, USA July 12-14, 2017

Better C++ / Chicago

by Jason Turner

About the training:

Through this training you will gain a better understanding of how to write clean, maintainable, and well performing C++ code.

The topics covered apply to all types of C++ development: embedded, system or application development.

Jason's classes are highly interactive and have a limited class size to ensure that everyone has sufficient opportunity to participat

A la carte tickets are available for those wishing to attend only part of the training.

Wednesday: Demystifying C++11 and Beyond

C++11, 14, and 17 added many new features to C++ that have made many question the overhead of using these new features and the complexity they add to the language. We will make an in depth examination of these features to give you confidence in using and deploying modern C++ techniques in your organization.

Thursday: Understanding Object Lifetime in C++

C++ has what very few other languages have: a well defined object life cycle. Understanding this key aspect of the language is critical for writing high quality C++.
We will describe the lifecycle of an object in C++ and work through increasingly complex examples. There will be something for C++ developers of all skill levels to learn.

Friday: C++ Best Practices

On the final day of the course we will cover a series of tangible best practice rules for how to write C++ code that is maintainable and efficient by default.
We will wrap up with a discussion of how to use the tools available to maintain code quality.

Quick Q: Is list::size() really O(n)?

Quick A: In C++11 it's required to be constant time.

Recently on SO:

Is list::size() really O(n)?

In C++11 it is required that for any standard container the .size() operation must be complete in "constant" complexity (O(1)). (Table 96 — Container requirements). Previously in C++03 .size() should have constant complexity, but is not required (see Is std::string size() a O(1) operation?).

The change in standard is introduced by n2923: Specifying the complexity of size() (Revision 1).