Professional Documents
Culture Documents
features
Is this release good, great, amazing or meh?
The new standard for C++17 was approved at the beginning of September. But what was the journey to that point? How it all
started?
https://isocpp.org/std/status
Here’s the up-to-date version of the timeline for the C++ standard. Around 13 years we need to wait for C++11 (since 98), but then the work
speeded up! It’s clear from that picture how much work is going on. There’s the current trunk, plus several major branches with larger features
(TS). At some point those branches are merged into the trunk. The committee meets several times per year and votes on the proposals.
https://isocpp.org/std/the-committee
Here’s the overview of all the groups that work on new features.
Each larger feature has it’s own group!
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4700.pdf
https://github.com/cplusplus/draft
If you have problem with sleep just download the draft for the
standard (for free) and start reading!
Ship every 3 years
Use “noexcept”
Fixes
static_assert with no message
New auto rules for direct-list-initialization
auto x5{ 3 }; // decltype(x5) is int, not initializer_list
std::lock_guard<std::shared_timed_mutex,
std::shared_lock<std::shared_timed_mutex>> lck(mut_, r1);
template<typename ...Args>
void FoldPrint(Args&&... args)
{
(cout << ... << forward<Args>(args)) << '\n';
}
// SFINAE
template <typename T, std::enable_if_t < std::is_pointer<T>{} > * = nullptr >
auto get_value(T t)
{
return *t;
}
@cppreference.com
Attributes available in C++17
[[noreturn]]
[[carries_dependency]]
[[deprecated]]
[[deprecated("msg")]]
[[fallthrough]]
[[nodiscard]]
[[maybe_unused]]
How will it simplify the code?
Inline variables
Great for header-only libs!
constexpr if
Structured Binding Declarations
// works with arrays:
double myArray[3] = { 1.0, 2.0, 3.0 };
auto[a, b, c] = myArray;
}
Init-statement for if/switch
{ if (auto val = GetValue(); condition(val))
auto val = GetValue(); // on success
if (condition(val)) else
// on success // on false...
else
// on false...
}
Utils a = 10.0f;
cout << std::any_cast<float>(a);
default_searcher
boyer_moore_searcher
boyer_moore_horspool_searcher
http://www.bfilipek.com/2017/09/cpp17-details-utils.html
Compiler support
GCC 7.0 is feature complete
Clang 5.0
MSVC 2017.4 has most of the features
The separate part is the standard library for each compiler. They might be delayed,
especially regarding parallel versions of the algorithms.
Summary
Is C++17 great? Amazing? Or just meh… ?
http://www.bfilipek.com/2017/09/c17-in-detail-summary-bonus.html
https://isocpp.org/