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

Created on 2021-01-25.00:00:00 last changed 1 month ago

Messages

Date: 2021-03-12.15:04:50

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: 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
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