Search Results

Search found 1 results on 1 pages for 'volnet'.

Page 1/1 | 1 

  • Why it's can be compiled in GNU/C++, can't compiled in VC++2010 RTM?

    - by volnet
    #include #include #include #include "copy_of_auto_ptr.h" #ifdef _MSC_VER #pragma message("#include ") #include // http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas #endif /* case 1-4 is the requirement of the auto_ptr. which form http://ptgmedia.pearsoncmg.com/images/020163371X/autoptrupdate/auto_ptr_update.html */ /* case 1. (1) Direct-initialization, same type, e.g. */ std::auto_ptr source_int() { // return std::auto_ptr(new int(3)); std::auto_ptr tmp(new int(3)); return tmp; } /* case 2. (2) Copy-initialization, same type, e.g. */ void sink_int(std::auto_ptr p) { std::cout source_derived() { // return std::auto_ptr(new Derived()); std::auto_ptr tmp(new Derived()); return tmp; } /* case 4. (4) Copy-initialization, base-from-derived, e.g. */ void sink_base( std::auto_ptr p) { p-go(); } int main(void) { /* // auto_ptr */ // case 1. // auto_ptr std::auto_ptr p_int(source_int()); std::cout p_derived(source_derived()); p_derived-go(); // case 4. // auto_ptr sink_base(source_derived()); return 0; } In Eclipse(GNU C++.exe -v gcc version 3.4.5 (mingw-vista special r3)) it's two compile error: Description Resource Path Location Type initializing argument 1 of void sink_base(std::auto_ptr<Base>)' from result ofstd::auto_ptr<_Tp::operator std::auto_ptr<_Tp1() [with _Tp1 = Base, _Tp = Derived]' auto_ptr_ref_research.cpp auto_ptr_ref_research/auto_ptr_ref_research 190 C/C++ Problem Description Resource Path Location Type no matching function for call to `std::auto_ptr::auto_ptr(std::auto_ptr)' auto_ptr_ref_research.cpp auto_ptr_ref_research/auto_ptr_ref_research 190 C/C++ Problem But it's right in VS2010 RTM. Questions: Which compiler stand for the ISO C++ standard? The content of case 4 is the problem "auto_ptr & auto_ptr_ref want to resolve?"

    Read the article

1