You can nest namespaces like this:
namespace A::B::C {
...
}Instead of this:
namespace A {
namespace B {
namespace C {
...
}
}
}From C++17 class template arguments can be deduced automatically. Automatic template argument deduction was available earlier only for template functions.
std::pair p(1, 'x'); // C++17: OK, C++14: error: missing
//template arguments before p
std::pair<int, std::string> p(1, 'x'); // C++14: OK
auto p = std::make_pair(1, 'x'); // C++17: OK, C++14: OKNew versions of the if and switch statements for C++:
status_code foo() { // C++14
{ //variable c scope
status_code c = bar();
if (c != SUCCESS) {
return c;
}
}
// ...
}status_code foo() { // C++17
if (status_code c = bar(); c != SUCCESS) {
return c;
}
// ...
}{
Foo gadget(args);
switch (auto s = gadget.status()) { // C++14
case OK: gadget.zip(); break;
case Bad: throw BadFoo(s.message());
}
}switch (Foo gadget(args); auto s = gadget.status()) { // C++17
case OK: gadget.zip(); break;
case Bad: throw BadFoo(s.message());
}