C++17: Deprecated features

Deprecate redeclaration of static constexpr class members

When inline variables are presented in C++17, static constexpr redeclaration is not needed.

 

Deprecate C library headers

List of C libraries which are deprecated from C++17:

<ccomplex> – simply deleting the requirement for a <ccomplex> header is simpler, and may be better, than making it optional. Of course an implementation would not need to change in order to conform to the new state of affairs, but programs that use <ccomplex> instead of <complex> would cease to be strictly conforming.

<ctgmath> – simply includes header <ccomplex> and <cmath>

<cstdalign> – mentioned as pointless in C++

<cstdbool> – mentioned as pointless in C++

Deprecate old library parts

Many members of std::allocator redundantly duplicate behavior that is otherwise produced by std::allocator_traits<allocator<T>>, and could safely be removed to simplify this class.

While C++ group cannot remove these members without breaking backwards compatibility with code that explicitly used this allocator type, they should not be recommending their continued use.

Marked as deprecated:

  • std::iterator
  • std::allocator<void>
  • std::is_literal_type
  • std::raw_storage_iterator
  • std::get_temporary_buffer
  • std::return_temporary_buffer

Deprecate <codecvt>

Yet the <codecvt> facets don’t provide the safe forms of error handling as their defaults, and it is far to hard to use them in a safe way. The standard library badly needs modern C++ UTF conversion facilities, yet <codecvt> is an embarrassment. libstdc++ didn’t support until very recently.

 

Deprecate memory_order_consume temporarily 

It is widely accepted that the current definition of memory_order_consume in the standard is not useful. All current compilers essentially map it to memory_order_acquire. The difficulties appear to stem both from the high implementation complexity, from the fact that the current definition uses a fairly general definition of “dependency”, thus requiring frequent and inconvenient use of the kill_dependency call, and from the frequent need for [[carries_dependency]] annotations.

 

Deprecate shared_ptr::unique

The removal of the “debug only” restriction for use_count and unique in shared_ptr introduced a bug: in order for unique to produce a useful and reliable value, it needs a synchronize clause to ensure that prior accesses through another reference are visible to the successful caller of unique. Many current implementations use a relaxed load, and do not provide this guarantee, since it’s not stated in the Standard. For debug/hint usage that was OK. Without it the specification is unclear and misleading.

 

Deprecate result_of

Deprecated function, added new function without function type encoding whose name needs to be determined std::invoke_result().

 

Leave a Reply

Your email address will not be published. Required fields are marked *