目录

All Major C++17 Features You Should Know

本文为摘录(或转载),侵删,原文为: https://www.cppstories.com/2017/01/cpp17features/

static_assert() 可以不用再写 message 了, 类似 C assert

模板中以前只能用 class 来声明类型,现在可以用 typename

1
2
3
4
5
template <template <typename...> typename Container>
//            used to be invalid ^^^^^^^^
struct foo;

foo<std::vector> my_foo;

Allows to write:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
namespace A::B::C {
   // ...
}

Rather than:

namespace A {
    namespace B {
        namespace C {
            // ...
        }
    }
}