Title
§[stacktrace.basic.nonmem]: operator<< should be less templatized
Status
c++23
Section
[stacktrace.syn][stacktrace.basic.nonmem]
Submitter
Jiang An

Created on 2021-01-25.00:00:00 last changed 13 months ago

Messages

Date: 2022-11-17.00:42:33

Proposed resolution:

This wording is relative to N4878.

  1. Modify [stacktrace.syn], header <stacktrace> synopsis, as indicated:

    namespace std {
      // [stacktrace.entry], class stacktrace_entry
      class stacktrace_entry;
      
      // [stacktrace.basic], class template basic_stacktrace
      template<class Allocator>
      class basic_stacktrace;
      
      […]
      
      // [stacktrace.basic.nonmem], non-member functions
      […]
      
      string to_string(const stacktrace_entry& f);
      
      template<class Allocator>
        string to_string(const basic_stacktrace<Allocator>& st);
      
      template<class charT, class traits>
        basic_ostream<charT, traits>&
          operator<<(basic_ostream<charT, traits>& os, const stacktrace_entry& f);
        
      template<class charT, class traits, class Allocator>
        basic_ostream<charT, traits>&
          operator<<(basic_ostream<charT, traits>& os, const basic_stacktrace<Allocator>& st);
      
      […]
    }
    
  2. Modify [stacktrace.basic.nonmem] as indicated:

    template<class charT, class traits>
    basic_ostream<charT, traits>&
      operator<<(basic_ostream<charT, traits>& os, const stacktrace_entry& f);
    

    -4- Effects: Equivalent to: return os << to_string(f);

    template<class charT, class traits, class Allocator>
    basic_ostream<charT, traits>&
      operator<<(basic_ostream<charT, traits>& os, const basic_stacktrace<Allocator>& st);
    

    -5- Effects: Equivalent to: return os << to_string(st);

Date: 2022-11-12.00:00:00

[ 2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Immediate → WP. ]

Date: 2022-11-15.00:00:00

[ 2022-11-07; Kona ]

Move to Immediate.

Date: 2021-03-15.00:00:00

[ 2021-03-12; Reflector poll ]

Set priority to 2 and status to LEWG following reflector poll.

Date: 2021-01-25.00:00:00

According to [string.io], the operator<< overloads in [stacktrace.basic.nonmem] are well-formed only if the template parameters charT and traits are char and std::char_traits<char> (that of std::string) respectively, because it is required in Effects: that these overloads behave as-if insert a std::string.

I think the declarations of these overloads should be changed to:

ostream& operator<<(ostream& os, const stacktrace_entry& f); 

template<class Allocator>
ostream& operator<<(ostream& os, const basic_stacktrace<Allocator>& st);
History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2022-11-17 00:42:33adminsetmessages: + msg13087
2022-11-17 00:42:33adminsetstatus: immediate -> wp
2022-11-08 04:50:27adminsetmessages: + msg12952
2022-11-08 04:50:27adminsetstatus: lewg -> immediate
2021-03-12 15:04:50adminsetmessages: + msg11725
2021-03-12 15:04:50adminsetstatus: new -> lewg
2021-01-31 13:18:44adminsetmessages: + msg11668
2021-01-25 00:00:00admincreate