incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (STDCXX-375) std::getline() declared in <istream>, but should be declared in <string>
Date Thu, 29 Nov 2007 20:53:43 GMT

    [ https://issues.apache.org/jira/browse/STDCXX-375?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546884
] 

Farid Zaripov commented on STDCXX-375:
--------------------------------------

I've tried to declare the std::getline() in this testcase.
The following test fails to compile in MSVC with error: error C2027: use of undefined type
'std::basic_istream<_CharT>' in line 16.

-----------
#include <string>
#include <iosfwd>

namespace std {

template<class _CharT, class _Traits, class _Allocator>
basic_istream<_CharT, _Traits>&
getline (basic_istream<_CharT, _Traits>&,
         basic_string<_CharT, _Traits, _Allocator>&);

}

void test (std::istream& is)
{
    std::string str;
    std::getline (is, str);
}
-----------

But if I change the test() function to return the is, the test has compiled without errors.

-----------
std::istream& void test (std::istream& is)
{
    std::string str;
    return std::getline (is, str);
}
-----------



> std::getline() declared in <istream>, but should be declared in <string>
> ------------------------------------------------------------------------
>
>                 Key: STDCXX-375
>                 URL: https://issues.apache.org/jira/browse/STDCXX-375
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 21. Strings
>    Affects Versions: 4.1.3, 4.1.4
>         Environment: All
>            Reporter: Farid Zaripov
>             Fix For: 4.2.1
>
>
> The following code fails to compile with errors:
> test.cpp(7) : error C2039: 'getline' : is not a member of 'std'
> test.cpp(7) : error C3861: 'getline': identifier not found, even with argument-dependent
lookup
> test.cpp:
> ---------------------------
> #include <string>
> #include <iosfwd>
> void test (std::istream& is)
> {
>     std::string str;
>     std::getline (is, str);
> }
> ---------------------------
> The addition information here: http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200703.mbox/%3c7BDB2168BEAEF14C98F1901FD2DE6438594C10@epmsa009.minsk.epam.com%3e

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message