Title
reference_wrapper<T>::result_type is underspecified
Status
c++11
Section
[refwrap]
Submitter
Daniel Krügler

Created on 2010-12-08.00:00:00 last changed 161 months ago

Messages

Date: 2011-02-23.18:50:30

Proposed resolution:

The suggested wording changes are against the working draft N3242.

  1. Change [refwrap] p. 2 as indicated:

    2 reference_wrapper<T> has a weak result type (20.8.2). If T is a function type, result_type shall be a synonym for the return type of T.

Date: 2011-02-23.00:00:00

[ 2011-02-23 Reflector discussion ]

Moved to Tentatively Ready after 5 votes.

Date: 2010-12-08.00:00:00

Issue 1295 correctly removed function types and references to function types from the bullet 1 of [func.require] p. 3 because neither function types nor function references satisfy the requirements for a target object which is defined to be an object of a callable type. This has the effect that the reference in [refwrap] p. 2

reference_wrapper has a weak result type (20.8.2).

is insufficient as a reference to define the member type result_type when the template argument T is a function type.

There are basically two approaches to solve the problem:

  1. Extend the definition of a weak result type in [func.require] p. 3 to both function types and references thereof. This extension must be specified independend from the concept of a call wrapper, though.

  2. Add one extra sentence to [refwrap] p. 2 that simply defines the member type result_type for reference_wrapper<T>, when T is a function type.

I checked the current usages of weak result type to have a base to argue for one or the other approach. It turns out, that there is no further reference to this definition in regard to function types or references thereof. The only other reference can be found in [func.bind.bind] p. 3, where g is required to be a class type.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2011-04-11 11:23:23adminsetstatus: voting -> wp
2011-03-05 15:24:28adminsetstatus: ready -> voting
2011-02-23 18:50:30adminsetmessages: + msg5529
2011-02-23 18:50:30adminsetstatus: new -> ready
2010-12-08 20:35:42adminsetmessages: + msg5468
2010-12-08 00:00:00admincreate