• Forum
  • Lounge
  • When will there be C++17 reference on th

 
When will there be C++17 reference on this site?

Hi guys,
I know that cppreference.com already has a reference for the C++17 standard, so when do you think reference for the new upcoming C++17 standard will be available on this site?
Thanks
The year 2017 hasn't arrived yet.
No need to rush, it is not the time C++17 standard is offically released and there is no C++ compiler with offical C++17 support available.
C++17 is feature-complete (as of June 2016) and is currently in the CD ballot stage.

Compiler support, summarised by Cubbi:
Since C++17 was a fairly minor update to core language, but major update to the library, I would expect gcc and clang will claim full core language in the same year, and finish up their libraries in 2018 (gcc learned from their 2011 mess and already has a lead there, but clang is very aggressively competitive), and Microsoft will likely do both core language and library in 2018 as well (their library was fully up to date with C++17-so-far at the beginning of 2016)
http://www.cplusplus.com/forum/lounge/193877/#msg932780


cppreference.com is a wiki, maintained by a knowledgeable community. It would be unreasonable to expect the content in cplusplus.com to match that of cppreference.com in either quality or contemporariness.
Could someone summarise the new items in C++17? (I appreciate they might not be fully ratified yet.)
Almost all new items in C++17 are advanced features.
Just mastering everyday-life C++ concepts and features is hard enough already.
Could someone summarise the new items in C++17?

Okay. I'm taking the dense summary from http://en.cppreference.com/w/cpp/language/history and expanding a bit

Language changes:

fold-expressions http://en.cppreference.com/w/cpp/language/fold
1
2
3
4
template<class ...Args>
void printer(Args&&... args) {
    (std::cout << ... << args) << '\n';
}


template argument deduction for constructors http://en.cppreference.com/w/cpp/language/class_template_deduction

1
2
std::tuple t(4, 3, 2.5); // same as auto t = std::make_tuple(4, 3, 2.5);
auto lck = std::lock_guard(mtx); // deduces to std::lock_guard<std::mutex> 


auto non-type parameters
1
2
3
template<auto n> struct B { /* ... */ };
B<5> b1;   // OK: non-type template parameter type is int
B<'a'> b2; // OK: non-type template parameter type is char 


compile-time if constexpr
Example in action: http://en.cppreference.com/w/cpp/utility/variant/visit#Example
1
2
if constexpr (std::is_same_v<T, int>)
                std::cout << "int with value " << arg << '\n';


inline variables
inline double global = 2.0; // now can put variables in headers

structured binding http://en.cppreference.com/w/cpp/language/declarations#Decomposition_declaration
const auto [x, y] = f();

if(init;condition) and switch(init;condition)
1
2
3
std::set<string> myset;
if (auto [iter, success] = myset.insert("Hello"); success) 
    do_something_with(iter);


u8-char u8'a'

simplified nested namespaces
1
2
3
4
5
6
// before c++17
namespace a {
 namespace b {
   namespace c {
// since c++17
namespace a::b::c {


noexcept is part of type system

allocation functions with explicit alignment:
new T; calls operator new(sizeof(T), std::align_val_t(alignof(T))))

guaranteed copy elision
http://en.cppreference.com/w/cpp/language/copy_elision

__has_include
http://en.cppreference.com/w/cpp/preprocessor/include

lambda capture of *this [=, *this]{};

constexpr lambda []() constexpr { body }

attribute namespaces don't have to repeat

new attributes: [[fallthrough]], [[nodiscard]], [[maybe_unused]]

Removed trigraphs, the register keyword, and bool increment

Library additions:

std::variant http://en.cppreference.com/w/cpp/utility/variant

std::has_unique_object_representations http://en.cppreference.com/w/cpp/types/has_unique_object_representations

std::launder http://en.cppreference.com/w/cpp/utility/launder

uninitialized memory tools (destroy_at/destroy/destroy_n, uninitialized_move, uninitialized_value_construct, etc) http://en.cppreference.com/w/cpp/memory#Uninitialized_storage

map/set extract and map/set merge
http://en.cppreference.com/w/cpp/container/map/extract
http://en.cppreference.com/w/cpp/container/map/mege

std::make_from_tuple
http://en.cppreference.com/w/cpp/utility/make_from_tuple

contiguous iterators, non-member size/empty/data
http://en.cppreference.com/w/cpp/iterator/size
http://en.cppreference.com/w/cpp/iterator/empty
http://en.cppreference.com/w/cpp/iterator/data

map/unordered_map try_emplace and insert_or_assign
http://en.cppreference.com/w/cpp/container/map/try_emplace
http://en.cppreference.com/w/cpp/container/map/insert_or_assign

uncaught_exceptions
http://en.cppreference.com/w/cpp/error/uncaught_exception

variadic lock_guard
http://en.cppreference.com/w/cpp/thread/lock_guard

as_const
http://en.cppreference.com/w/cpp/utility/as_const

conjunction/disjunction/negation
http://en.cppreference.com/w/cpp/types/conjunction
http://en.cppreference.com/w/cpp/types/disjunction
http://en.cppreference.com/w/cpp/types/negation

type trait variables xxx_v

transparent owner_less<>
http://en.cppreference.com/w/cpp/memory/owner_less

rounding functions for duration and time_point
http://en.cppreference.com/w/cpp/chrono/duration#Non-member_functions
http://en.cppreference.com/w/cpp/chrono/time_point#Non-member_functions

not_fn
http://en.cppreference.com/w/cpp/utility/functional/not_fn

weak_from_this
http://en.cppreference.com/w/cpp/memory/enable_shared_from_this/weak_from_this

is_always_lock_free
http://en.cppreference.com/w/cpp/atomic/atomic/is_always_lock_free

is_swappable
http://en.cppreference.com/w/cpp/types/is_swappable

clamp
http://en.cppreference.com/w/cpp/algorithm/clamp

3D hypot
http://en.cppreference.com/w/cpp/numeric/math/hypot

cache line interface
http://en.cppreference.com/w/cpp/thread/hardware_destructive_interference_size

is_callable
http://en.cppreference.com/w/cpp/types/is_callable

From TS's

the filesystem library (withrelative path support (proximate, relative, weakly_canonical) added) http://en.cppreference.com/w/cpp/filesystem

the library fundamentals v1 (including optional, any, string_view, polymorphic allocators, searchers, apply)
http://en.cppreference.com/w/cpp/utility/optional
http://en.cppreference.com/w/cpp/utility/any
http://en.cppreference.com/w/cpp/string/basic_string_view
http://en.cppreference.com/w/cpp/memory#Allocators
http://en.cppreference.com/w/cpp/utility/functional#Searchers
http://en.cppreference.com/w/cpp/utility/apply


parallelism v1 (including execution policies, reduce, inclusive_scan, exclusive_scan), but removing exception_list.
http://en.cppreference.com/w/cpp/algorithm/execution_policy_tag_t
http://en.cppreference.com/w/cpp/algorithm/reduce
http://en.cppreference.com/w/cpp/algorithm/inclusive_scan
http://en.cppreference.com/w/cpp/algorithm/exclusive_scan
http://en.cppreference.com/w/cpp/algorithm/for_each_n
and every algorithm in <algorithm> and <numeric> gets parallelized overloads

From special math IS: special mathematical functions
http://en.cppreference.com/w/cpp/numeric/special_math

From library fundamentals v2: std::gcd, std::lcm
http://en.cppreference.com/w/cpp/numeric/gcd
http://en.cppreference.com/w/cpp/numeric/lcm

From C11: std::aligned_alloc, std::timespec_get
http://en.cppreference.com/w/cpp/memory/c/aligned_alloc
http://en.cppreference.com/w/cpp/chrono/c/timespec_get

Deprecated std::iterator, std::raw_storage_iterator, get_temporary_buffer, is_literal_type, Removed auto_ptr, the deprecated function objects, the obsolete iostreams aliases.
Last edited on
Thanks for taking the time to do this, Cubbi.
Thanks for taking the time to do this, Cubbi.

I am one of the cppreference maintainers, of course I jump at this opportunity! (but I hope twicker won't wait long, competition did a lot of good for both references)
closed account (1vD3vCM9)
Oh boy, that's a lot of new additions
I've been mostly keeping-up with the standard, but this is the first I've heard about fold expressions. Why is this a core language feature when it's possible to accomplish the same thing with templates?

Maybe I should just go read the paper :D

Topic archived. No new replies allowed.