 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
pascalroca Guest
|
Posted: Thu Aug 03, 2006 9:11 am Post subject: big gap between visual studio 6 and 2003 |
|
|
class myClass
{
int lacement ;
public :
myClass(){};
myClass(const myClass& ref){}
virtual std::vector< std::auto_ptr< myClass> > getValeur() = 0;
};
typedef std::auto_ptr< myClass> myClassPtr;
class myClassImpl : public myClass
{
public :
myClassImpl(){};
myClassImpl(const myClassImpl& ref){}
virtual std::vector<myClassPtr> getValeur()
{
std::vector<myClassPtr> vec;
return vec;
};
};
this code compile under visual studio 6
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\xmemory(42): error C2558:
class 'std::auto_ptr<_Ty>' : no copy constructor available or copy
constructor is declared 'explicit'
with
[
_Ty=myClass
]
// TEMPLATE FUNCTION _Construct
template<class _T1,
class _T2> inline
void _Construct(_T1 _FARQ *_Ptr, const _T2& _Val)
{ // construct object at _Ptr with value _Val
new ((void _FARQ *)_Ptr) _T1(_Val);
}
it tries to construct an abstract class...... |
|
| Back to top |
|
 |
peter koch Guest
|
Posted: Thu Aug 03, 2006 9:11 am Post subject: Re: big gap between visual studio 6 and 2003 |
|
|
pascalroca wrote:
[snip]
| Quote: | virtual std::vector< std::auto_ptr< myClass> > getValeur() = 0;
[snip]
this code compile under visual studio 6
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\xmemory(42): error C2558:
class 'std::auto_ptr<_Ty>' : no copy constructor available or copy
constructor is declared 'explicit'
|
[snip]
You can't have std::auto_ptr in a std::vector. This has always been the
case and you're lucky if it did work for you before. You must use for
some other solution. I would recommend you looked at boost which has
several constructs that can help you.
/Peter |
|
| Back to top |
|
 |
Powered by phpBB © 2001, 2006 phpBB Group
|