Monday, March 9, 2009

Specifying C++ Concepts


Download here---pdf----Specifying C++ Concepts

Specifying C++ Concepts


Abstract
C++ templates are key to the design of current successful
mainstream libraries and systems. They are the basis of programming
techniques in diverse areas ranging from conventional
general-purpose programming to software for safetycritical
embedded systems. Current work on improving templates
focuses on the notion of concepts (a type system for
templates), which promises significantly improved error diagnostics
and increased expressive power such as conceptbased
overloading and function template partial specialization.
This paper presents C++ templates with an emphasis on
problems related to separate compilation. We consider the
problem of how to express concepts in a precise way that
is simple enough to be usable by ordinary programmers. In
doing so, we expose a few weakness of the current specification
of the C++ standard library and suggest a far more
precise and complete specification. We also present a systematic
way of translating our proposed concept definitions,
based on use-patterns rather than function signatures, into
constraint sets that can serve as convenient basis for concept
checking in a compiler.


Introduction and overview
The problem
Template basics
Parameterization
Instantiations and checking
Performance
A more realistic example
An iterator concept for fill
Iterator concepts
A concept system
Concept definition
Explicit check request
Implicit check request
From concepts to constraints sets
Concept checking
Associated types and values
fill and associates revisited
The Assignable and Movable puzzle
Unary iterator predicates
Assignable
Standard iterator concepts
Siek’s proposal
Type classes
Qualified types









0 comments:

Post a Comment