J
jean.daniel.michaud
Hi all,
Something I don't get.
The code is:
// snippet on
#include <list>
#include <iostream>
int main()
{
std::list<std:stream> list;
list.push_back(std::cout);
return 0
}
// snippet off
Compiles with msvc (visual 6) but not with vc-8_0 (visual 2005).
vc-8_0 output (C:\>cl /EHsc test.cpp) :
// output on
test.cpp
G:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\ostream(581) :
error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot
access private member declared in class
'std::basic_ios<_Elem,_Traits>'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
G:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE
\ios(151) : see declaration of
'std::basic_ios<_Elem,_Traits>::basic_ios'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
This diagnostic occurred in the compiler generated function
'std::basic_ostream<_Elem,_Traits>::basic_ostream(const
std::basic_ostream<_Elem,_Traits> &)'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
// output off
Why ? std::cout is supposed to be a std:stream right ? I tried a
static_cast<std:stream &>, but no luck...
Any idea?
JD
Something I don't get.
The code is:
// snippet on
#include <list>
#include <iostream>
int main()
{
std::list<std:stream> list;
list.push_back(std::cout);
return 0
}
// snippet off
Compiles with msvc (visual 6) but not with vc-8_0 (visual 2005).
vc-8_0 output (C:\>cl /EHsc test.cpp) :
// output on
test.cpp
G:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\ostream(581) :
error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot
access private member declared in class
'std::basic_ios<_Elem,_Traits>'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
G:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE
\ios(151) : see declaration of
'std::basic_ios<_Elem,_Traits>::basic_ios'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
This diagnostic occurred in the compiler generated function
'std::basic_ostream<_Elem,_Traits>::basic_ostream(const
std::basic_ostream<_Elem,_Traits> &)'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
// output off
Why ? std::cout is supposed to be a std:stream right ? I tried a
static_cast<std:stream &>, but no luck...
Any idea?
JD