Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - (possibly a) bug report (or maybe an STLport bug?)
#include "state_machine.hpp" #include "boost/mpl/list.hpp" #include <iostream> class base { }; template < typename derived > struct base_template_derived { virtual std::auto_ptr< base > clone() const { return std::auto_ptr<base> ( (base*) // *** comment-out for error *** new derived( static_cast< derived const & >(*this) ) ); } }; struct final : base_template_derived< final > {}; //sc player.cpp -mn -C -WA -S -3 -a8 -c -gf -D_CONSOLE=1 -IG:\dm\STLport-5.0-1031\stlport -IG:\boost-1.30.2 -IG:\boost-1.30.2\boost\mpl -IG:\boost-1.30.2\libs\mpl\example\fsm -IG:\dm\include -oplayer.obj //Error: g:\BOOST-1.30.2\LIBS\MPL\EXAMPLE\FSM\player.cpp(34): cannot find constructor for class matching std::auto_ptr<>::std::auto_ptr<>(final*) Dec 01 2003
template < typename derived > struct base_template_derived { Dec 01 2003
//I'll just clean it up a bit: #include <memory> class base { }; template < typename derived > struct base_template_derived { virtual std::auto_ptr< base > clone() const { return std::auto_ptr<base> ( (base*) // *** comment-out for error *** new derived( static_cast< derived const & >(*this) ) ); } }; struct final : base_template_derived< final > {}; Notice my ugly cast, which seems to fix the problem somehow. If you comment it out, you get the error below: //sc player.cpp -mn -C -WA -S -3 -a8 -c -gf -D_CONSOLE=1 -IG:\dm\STLport-5.0-1031\stlport -IG:\boost-1.30.2 -IG:\boost-1.30.2\boost\mpl -IG:\boost-1.30.2\libs\mpl\example\fsm -IG:\dm\include -oplayer.obj //Error: g:\BOOST-1.30.2\LIBS\MPL\EXAMPLE\FSM\player.cpp(34): cannot find constructor for class matching std::auto_ptr<>::std::auto_ptr<>(final*) Hope it helps, and sorry to post thrice. Dec 01 2003
#include <memory> class base { }; template < typename derived > struct base_template_derived : base // *** missed in prev.post { virtual std::auto_ptr< base > clone() const { return std::auto_ptr<base> ( (base*) // *** comment-out for error *** new derived( static_cast< derived const & >(*this) ) ); } }; struct final : base_template_derived< final > {}; Notice my ugly cast, which seems to fix the problem somehow. If you comment it out, you get the error below: //sc player.cpp -mn -C -WA -S -3 -a8 -c -gf -D_CONSOLE=1 -IG:\dm\STLport-5.0-1031\stlport -IG:\boost-1.30.2 -IG:\boost-1.30.2\boost\mpl -IG:\boost-1.30.2\libs\mpl\example\fsm -IG:\dm\include -oplayer.obj //Error: g:\BOOST-1.30.2\LIBS\MPL\EXAMPLE\FSM\player.cpp(34): cannot find constructor for class matching std::auto_ptr<>::std::auto_ptr<>(final*) Hope it helps, and sorry to post... 4 times ... :( Dec 01 2003
|