Title
unique_ptr does not define operator<< for stream output
Status
wp
Section
[unique.ptr]
Submitter
Peter Dimov

Created on 2017-03-19.00:00:00 last changed 34 months ago

Messages

Date: 2017-07-15.22:58:07

Proposed resolution:

This wording is relative to N4659.

  1. Change [memory.syn], header <memory> synopsis, as indicated:

    namespace std {
      […]
      
      // [unique.ptr], class template unique_ptr
      […]
      template <class T, class D>
      bool operator>=(nullptr_t, const unique_ptr<T, D>& y);
      
      template<class E, class T, class Y, class D>
      basic_ostream<E, T>& operator<< (basic_ostream<E, T>& os, const unique_ptr<Y, D>& p);
      […]
    }
    
  2. Change [unique.ptr], class template unique_ptr synopsis, as indicated:

    namespace std {
      […]
      template <class T, class D>
      bool operator>=(nullptr_t, const unique_ptr<T, D>& y);
      
      template<class E, class T, class Y, class D>
      basic_ostream<E, T>& operator<< (basic_ostream<E, T>& os, const unique_ptr<Y, D>& p);
    }
    
  3. Add a new subclause following subclause [unique.ptr.special] as indicated:

    23.11.1.?? unique_ptr I/O [unique.ptr.io]

    template<class E, class T, class Y, class D>
      basic_ostream<E, T>& operator<< (basic_ostream<E, T>& os, const unique_ptr<Y, D>& p);
    

    -?- Effects: Equivalent to os << p.get();

    -?- Returns: os.

    -?- Remarks: This function shall not participate in overload resolution unless os << p.get() is a valid expression.

Date: 2017-07-15.22:58:07

[ 2017-07 Toronto Wed Issue Prioritization ]

Priority 0; move to Ready

Date: 2017-03-19.00:00:00

shared_ptr does define operator<<, and unique_ptr should too, for consistency and usability reasons.

History
Date User Action Args
2017-11-13 19:01:36adminsetstatus: voting -> wp
2017-10-17 18:34:55adminsetstatus: ready -> voting
2017-07-15 22:58:07adminsetmessages: + msg9377
2017-07-15 22:58:07adminsetstatus: new -> ready
2017-04-22 14:21:01adminsetmessages: + msg9151
2017-03-19 00:00:00admincreate