CppCon 2017: Walter E. Brown “Programming with C++ Constraints: Background, Utility, and Gotchas'

preview_player
Показать описание


Compile-time constraints will likely soon become part of our routine C++ programming vocabulary. Why? Such constraints are induced by new core language features (requires-clauses and requires-expressions) that are on the horizon for C++. What are these all about?

Almost every function imposes requirements on its users; violating those requirements typically leads to incorrect programs. Historically, such requirements had to be expressed in comments or other documentation, as there was little machinery to express them in code. Soon we will be able to express more requirements in code, thus allowing compilers to detect and address more violations.

This talk aims to prepare both new and veteran C++ programmers with the necessary background, tutorial information, and advice to exploit this powerful new supplement to function declarations. A case study, illustrating an unexpected gotcha, will conclude the presentation.

Walter E. Brown: retired

With broad experience in industry, academia, consulting, and research, Dr. Walter E. Brown has been a C++ programmer for over thirty-five years, joining the C++ standards effort in 2000. Among numerous other contributions, he is responsible for introducing such now-standard C++ library features as cbegin/cend, common_type, gcd, and void_t, as well as headers < random > and cend, common_type, gcd, and void_t, as well as headers < ratio>. He has also significantly impacted such core language features as alias templates, contextual conversions, variable templates, and static_assert. He conceived and served as project editor for the International Standard on Special Mathematical Functions in C++, now part of the forthcoming C++17.

When not playing with his grandchildren, Dr. Brown is an Emeritus participant in the C++ standards process, with several more core and library proposals under consideration.


*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

Awesome use of the new word "subsume" which was re-used in another context by the smart questioner at the end : )

mrlithium
Автор

Writing
template<class T> requires C<T> ...
instead of
template<C T> ...

is just like writing
void foo(auto x) requires int(x) ...
instead of
void foo(int x) ...
when declaring a function.

Hope they standardize the latter form.

MaceUA
Автор

As usual very clear presentation. Content is great, slides have the right level of complexity.

Radioguy
Автор

Very interesting and well presented, thank you.

sideparting
Автор

Is there a constant expression ternary operator: "constexpr(a) ? b : c"?

-taz-
Автор

How would the power example be used? What would calling it look like?

IllumTheMessage