A short interview with Dan Saks
Dan Saks talks about C++, C, embedded, and his upcoming Keynote at Meeting Embedded
A short interview with Dan Saks
by Jens Weller
October 25, Pavia, Italy
November 6-8, Berlin, Germany
November 3-8, Kona, HI, USA
By Meeting C++ | Oct 8, 2018 06:34 AM | Tags: meetingcpp embedded
Dan Saks talks about C++, C, embedded, and his upcoming Keynote at Meeting Embedded
A short interview with Dan Saks
by Jens Weller
By bfilipek | Oct 5, 2018 02:34 PM | Tags: None
The 5th episode of the 'most useful C++ links' is now available:
C++ Links #5
by Bartlomiej Filipek and Wojciech Razik
From the article:
Welcome to new C++ Links - most important and useful articles, podcasts and videos that happen between 29th September and 5th of October.
In this week you will find two trip reports from CppCon, an article about std::any (aka modern void*), a video about std::fmt library and many more!
By bfilipek | Sep 28, 2018 08:16 AM | Tags: None
4th episode of the most useful C++ links ![]()
C++ Links #4
by Bartlomiej Filipek & Wojciech Razik
From the article:
Welcome to new C++ Links - most important and useful articles, podcasts and videos that happen between 22th and 28th of September.
This week CppCon took place - the biggest C++ conference. In today’s list, you will find the first video from there, about future of C++, you can also see a post about removing duplicate elements from associative containers and an example of really defensive programming.
By Mantosh Kumar | Sep 25, 2018 08:01 PM | Tags: c++17
Discussion on "Modules".
Modularity in C++ 17
by Bjarne Stroustrup
From the article:
The creator of C++ provides an overview of modularity as it applies to C++ 17. This chapter is from the book "A Tour of C++, 2nd Edition".
By Corentin Jabot | Sep 20, 2018 11:34 AM | Tags: None
The case for Auto Non-Static Data Member Initializers
By Corentin Jabot
From the article:
In this article, we talk about Auto Non-Static Data Member Initializers in C++. All code snippet can be tested on Compiler Explorer thanks to Matt Godbolt.
In fact, the main motivation for this article is to put this feature in the hand of people to prove that it works and that it would be a great addition to the standard.
By Adrien Hamelin | Sep 18, 2018 12:31 PM | Tags: basics
Using the std to remove.
How to Remove Elements from a Sequence Container in C++
by Jonathan Boccara
From the article:
As part of the STL Learning Resource, we’re tackling today the STL algorithms that remove elements from a collection.
Removing an element from a C++ collection can’t be that complicated, can it?
Well, how can I put it… It has a rich complexity, let’s say.
Ok, maybe it’s a little complicated.
We will cover this topic in a series of four articles:
- How to Remove Elements from a Sequence Container (vector, string, deque, list)
- How to Remove Pointers from a Vector in C++ (co-written with Gaurav Sehgal)
- How to Remove Elements from an Associative Container (maps and sets)
- How to Remove Duplicates from an Associative Container
By Adrien Hamelin | Sep 18, 2018 12:30 PM | Tags: community
New links to check out!
C++ Links #2
by Bartlomiej Filipek
From the article:
Welcome to new C++ Links - most important and useful articles, podcasts and videos that happened between 8th and 14th of September. Today you will find a link to a post about the C++ quality of life features, a video with an explanation of the difference between const and constexpr, an article that describes some of SFINAE problems and many others.
By Adrien Hamelin | Sep 18, 2018 12:24 PM | Tags: intermediate c++17
Some to help, some to enable.
Modern C++ Features – Quality-of-Life Features
by Arne Mertz
From the article:
With the new C++ standards, we got a lot of features that feel like “quality-of-life” features. They make things easier for the programmer but do not add functionality that wasn’t already there. Except, some of those features do add functionality we couldn’t implement manually.
Some of those quality-of-life features are really exactly that. The standard often describes them as being equivalent to some alternative code we can actually type. Others are mostly quality-of-life, but there are edge cases where we can not get the effect by hand, or the feature is slightly superior to the manual implementation.
I will concentrate on core language features here, since most library features are implementable using regular C++. Only a few library features use compiler intrinsics...
By Adrien Hamelin | Sep 13, 2018 12:47 PM | Tags: intermediate c++11
Quick A: auto never deduces a reference.
Recently on SO:
C++11 auto: what if it gets a constant reference?
Read this article: Appearing and Disappearing consts in C++
Type deduction for auto variables in C++0x is essentially the same as for template parameters. (As far as I know, the only difference between the two is that the type of auto variables may be deduced from initializer lists, while the types of template parameters may not be.) Each of the following declarations therefore declare variables of type int (never const int):
auto a1 = i; auto a2 = ci; auto a3 = *pci; auto a4 = pcs->i;During type deduction for template parameters and auto variables, only top-level consts are removed. Given a function template taking a pointer or reference parameter, the constness of whatever is pointed or referred to is retained:
template<typename T> void f(T& p); int i; const int ci = 0; const int *pci = &i; f(i); // as before, calls f<int>, i.e., T is int f(ci); // now calls f<const int>, i.e., T is const int f(*pci); // also calls f<const int>, i.e., T is const intThis behavior is old news, applying as it does to both C++98 and C++03. The corresponding behavior for auto variables is, of course, new to C++0x:
auto& a1 = i; // a1 is of type int& auto& a2 = ci; // a2 is of type const int& auto& a3 = *pci; // a3 is also of type const int& auto& a4 = pcs->i; // a4 is of type const int&, tooSince you can retain the cv-qualifier if the type is a reference or pointer, you can do:
auto& my_foo2 = GetFoo();Instead of having to specify it as const (same goes for volatile).
Edit: As for why auto deduces the return type of GetFoo() as a value instead of a reference (which was your main question, sorry), consider this:
const Foo my_foo = GetFoo();The above will create a copy, since my_foo is a value. If auto were to return an lvalue reference, the above wouldn't be possible.
By Adrien Hamelin | Sep 13, 2018 12:36 PM | Tags: performance c++17
Are you using the parallel capacities of the std?
Using C++17 Parallel Algorithms for Better Performance
by Billy O’Neal
From the article:
C++17 added support for parallel algorithms to the standard library, to help programs take advantage of parallel execution for improved performance. MSVC first added experimental support for some algorithms in 15.5, and the experimental tag was removed in 15.7.
The interface described in the standard for the parallel algorithms doesn’t say exactly how a given workload is to be parallelized. In particular, the interface is intended to express parallelism in a general form that works for heterogeneous machines, allowing SIMD parallelism like that exposed by SSE, AVX, or NEON, vector “lanes” like that exposed in GPU programming models, and traditional threaded parallelism.
Our parallel algorithms implementation currently relies entirely on library support, not on special support from the compiler. This means our implementation will work with any tool currently consuming our standard library, not just MSVC’s compiler. In particular, we test that it works with Clang/LLVM and the version of EDG that powers Intellisense...