C++ Weekly Episode 24: C++17’s Structured Bindings—Jason Turner
Episode 24 of C++ Weekly.
C++17's Structured Bindings
by Jason Turner
About the show:
In this episode Jason introduces C++17's structured bindings.
February 10-15, Hagenberg, Austria
March 19-21, Madrid, Spain
April 1-4, Bristol, UK
June 16-21, Sofia, Bulgaria
By Jason Turner | Aug 16, 2016 09:12 AM | Tags: c++17 basics
Episode 24 of C++ Weekly.
C++17's Structured Bindings
by Jason Turner
About the show:
In this episode Jason introduces C++17's structured bindings.
By Adrien Hamelin | Aug 5, 2016 01:57 PM | Tags: basics
Quick A: A set does not allow the modification of its keys.
Recently on SO:
Why does std::set seem to force the use of a const_iterator?
A set is like a map with no values, only keys. Since those keys are used for a tree that accelerates operations on the set, they cannot change. Thus all elements must be const to keep the constraints of the underlying tree from being broken.
By Meeting C++ | Aug 3, 2016 01:15 AM | Tags: performance intermediate efficiency c++11 basics advanced
The last video from Meeting C++ 2015 is online:
Taming the Performance Beast
by Klaus Iglberger
By Jason Turner | Aug 1, 2016 02:05 PM | Tags: c++17 basics
Episode 22 of C++ Weekly.
C++17's Nested Namespaces and `std::clamp`
by Jason Turner
About the show:
This week Jason describes C++17's nested namespace support and the new library function `std::clamp`.
By Jason Turner | Jul 25, 2016 03:23 PM | Tags: c++17 basics
Episode 21 of C++ Weekly.
C++17's `if` and `switch` Init Statements
by Jason Turner
About the show:
This week Jason introduces C++17's new support for initializers in `if` and `switch` statements.
By Adrien Hamelin | Jul 25, 2016 02:07 PM | Tags: c++11 basics
Quick A: No, there is a specified syntax for it.
Recently on SO:
Is the new C++ return syntax limited?
Yeah, this is not something you'd normally guess.
virtual auto what() const noexcept -> const char * override;This is just the order you have to use. The syntax could have been different, probably, but this is what we've got.
By Adrien Hamelin | Jul 21, 2016 02:04 PM | Tags: basics
Did you know the difference?
Parameter or Argument?
by Malte Langkabel
From the article:
I often hear people getting confused when talking about parameters and arguments. That confusion grows even stronger when one of them knows the difference but the other one doesn’t. So let’s shed some light on this issue and spread the knowledge! Programming involves talking to each other but that doesn’t have to be more painful than it already is
By Marco Arena | Jul 20, 2016 07:09 AM | Tags: c++14 basics
In this installment we’ll meet associative containers:
C++ in Competitive Programming: associative containers
by Marco Arena
From the article:
Some days ago I gave my birthday party and I invited some friends. I want to know which name is the most common among my friends. Or, given a sequence of words, I want to know which one occurs the most...
By Adrien Hamelin | Jul 18, 2016 01:31 PM | Tags: c++11 basics
Quick A: To express constness, a const reference is what is needed.
Recently on SO:
How to express constness of a forwarding reference?
How can I express that f does not modify its parameter?If the function doesn't modify its parameter then there is no benefit to using a forwarding reference. You use a forwarding reference when you want to forward the parameter on to some other function which cares whether the argument is an lvalue or an rvalue (because maybe there are separate overloads for lvalues and rvalues, and the rvalue one can be more efficient).
If your function doesn't modify the argument then it shouldn't need to care whether it has an lvalue or rvalue, so it can just take
const T&
unconditionally. That can bind to both lvalues and rvalues, and promises not to modify the parameter.template<typename T> void f(const T& t) { ... }
By Adrien Hamelin | Jul 18, 2016 01:28 PM | Tags: community basics
Quick A: Not in the standard, but in other libraries yes.
Recently on SO:
Is there a range class in C++11 for use with range based for loops?
The C++ standard library does not have one, but Boost.Range has boost::counting_range, which certainly qualifies. You could also use boost::irange, which is a bit more focused in scope.