Title
Constrain rvalue stream operators
Status
c++17
Section
[ostream.rvalue][istream.rvalue]
Submitter
Robert Haberlach

Created on 2015-09-08.00:00:00 last changed 90 months ago

Messages

Date: 2016-08-05.03:33:05

Proposed resolution:

This wording is relative to N4527.

  1. Modify [ostream.rvalue] as indicated:

    template <class charT, class traits, class T>
      basic_ostream<charT, traits>&
      operator<<(basic_ostream<charT, traits>&& os, const T& x);
    

    -1- Effects: os << x

    -2- Returns: os

    -?- Remarks: This function shall not participate in overload resolution unless the expression os << x is well-formed.

  2. Modify [istream.rvalue] as indicated:

    template <class charT, class traits, class T>
      basic_istream<charT, traits>&
      operator>>(basic_istream<charT, traits>&& is, T& x);
    

    -1- Effects: is >> x

    -2- Returns: is

    -?- Remarks: This function shall not participate in overload resolution unless the expression is >> x is well-formed.

Date: 2016-08-05.03:33:05

[ 2016-08 - Chicago ]

Thurs AM: Moved to Tentatively Ready

Date: 2015-09-09.20:33:50

The rvalue stream insertion and extraction operators should be constrained to not participate in overload resolution unless the expression they evaluate is well-formed. Programming code that tests the validity of stream insertions (or extractions) using SFINAE can result in false positives, as the present declarations accept virtually any right-hand side argument. Moreover, there is no need for pollution of the candidate set with ill-formed specializations.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2016-11-14 03:59:28adminsetstatus: pending -> wp
2016-11-14 03:55:22adminsetstatus: ready -> pending
2016-08-05 03:33:05adminsetmessages: + msg8411
2016-08-05 03:33:05adminsetstatus: new -> ready
2015-09-09 20:13:59adminsetmessages: + msg7514
2015-09-08 00:00:00admincreate