Constrained Templates in C++

Abstract

This paper seeks to answer what C++ concepts are, the benefit they provide to C++ programmers, and where we would like to go looking ahead. To accomplish this, it will examine the current state of generic programming in C++, look at what other languages do to avoid the issue, and how concepts can be used to solve the problem in a manner which provides more freedom to the programmer. In the general sense, concepts allow the programmer to specify preconditions which must be satisfied on the inputs to generic code. The desire being to fully describe what is required by the code is for earlier detection of errors in order to produce better, more terse diagnostics amongst other benefits. This overview of C++ concepts additionally covers some of the work done in order to provide an implementation within the GNU Compiler Collection (GCC). Throughout the project, the concepts technical specification (TS) has been a moving target. While we had hoped to look into leveraging the preconditions to check the template definition, a process known as “separate checking,” time was spent instead on refactoring the base TS implementation. This paper will touch on benefits of separate checking and many of the issues involved

    Similar works