Title
Member function getline taking a string as parameter
Status
nad
Section
[istream.unformatted]
Submitter
Loïc Joly

Created on 2012-03-05.00:00:00 last changed 132 months ago

Messages

Date: 2013-05-20.16:39:06

Proposed resolution:

This wording is relative to N3376.

  1. Change the class template basic_istream synopsis, [istream], as indicated

    namespace std {
      template <class charT, class traits = char_traits<charT> >
      class basic_istream : virtual public basic_ios<charT,traits> {
      public:
        […]
        // 27.7.2.3 Unformatted input:
        […]
        basic_istream<charT,traits>& getline(char_type* s, streamsize n);
        basic_istream<charT,traits>& getline(char_type* s, streamsize n,
          char_type delim);
        template<class Allocator>
        basic_istream<charT,traits>& getline(basic_string<charT,traits,Allocator>& str);
        template<class Allocator>
        basic_istream<charT,traits>& getline(basic_string<charT,traits,Allocator>& str,
          char_type delim);
        […]
      };
    }
    
  2. Insert the following two new prototype descriptions after [istream.unformatted] paragraph 24:

    basic_istream<charT,traits>& getline(char_type* s, streamsize n);
    

    -24- Returns: getline(s,n,widen('\n'))

    template<class Allocator>
    basic_istream<charT,traits>& getline(basic_string<charT,traits,Allocator>& str);
    

    -??- Returns: std::getline(*this, str)

    template<class Allocator>
    basic_istream<charT,traits>& getline(basic_string<charT,traits,Allocator>& str, char_type delim);
    

    -??- Returns: std::getline(*this, str, delim)

Date: 2013-04-15.00:00:00

[ 2013-04-20, Bristol ]

Unanimous that this is a new feature request and not a issue.

Resolution: Tentatively NAD

Date: 2012-03-05.00:00:00

I think the following code should be legal:

void f(std::istream& is)
{
  std::string s;
  is.getline(s); // Would be equivalent to std::getline(is, s)
}
History
Date User Action Args
2013-05-20 16:39:06adminsetmessages: + msg6514
2013-05-20 16:39:06adminsetstatus: new -> nad
2012-03-06 00:07:17adminsetmessages: + msg6047
2012-03-05 00:00:00admincreate