C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

big gap between visual studio 6 and 2003

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
pascalroca
Guest





PostPosted: Thu Aug 03, 2006 9:11 am    Post subject: big gap between visual studio 6 and 2003 Reply with quote



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





PostPosted: Thu Aug 03, 2006 9:11 am    Post subject: Re: big gap between visual studio 6 and 2003 Reply with quote



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
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
 


Powered by phpBB © 2001, 2006 phpBB Group