Standard Library Applications for Deleted Functions

Document Number: N2292(07-0152)
Alisdair Meredith <>

Background and Rationale

One feature of the next version of the C++ Language will be Deleted Functions, as descibed originally in n2210. Note: an updated paper is expected in this same mailing.

This paper proposes to replace all use of private copy constructors and copy-assignement operators with deleted functions. This expresses the library specification clearly and unambiguously in code, removing the need for further explanatory text. It also brings consistency to the documentation where different clauses today vary in their use normative wording, comments in the signatures, or both to indicate the same thing.

An open issue would be whether the Deleted Functions should be declared as public or private. This paper recommends public, anticipating changes that might occur in the Modules TR that hide private declarations outside a module. Another consideration is the nature of error messages, which might be marginally clearer with public access to a deleted function than private access. However, it would not harm this paper significantly to revert to private for 0x.

There are currently no recommendations for use of the Default Function feature from the same paper. This might be considered for array, pair and tuple, but would have a larger impact on semantics. Any such change should be considered in conjunction with sequence initializers (n2215)

Proposed Changes to Working Draught (n2284)