Click here to Skip to main content
16,004,901 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dir replacement Pin
RomTibi24-Feb-08 7:57
RomTibi24-Feb-08 7:57 
GeneralRe: Dir replacement Pin
Hamid_RT25-Feb-08 6:49
Hamid_RT25-Feb-08 6:49 
Generalconfused about the friend keyword Pin
markt23-Feb-08 7:52
markt23-Feb-08 7:52 
GeneralRe: confused about the friend keyword Pin
bob1697223-Feb-08 8:08
bob1697223-Feb-08 8:08 
GeneralRe: confused about the friend keyword Pin
markt24-Feb-08 7:11
markt24-Feb-08 7:11 
Generalplease help me Pin
ftbk23-Feb-08 4:10
ftbk23-Feb-08 4:10 
GeneralRe: please help me Pin
Christian Graus23-Feb-08 12:41
protectorChristian Graus23-Feb-08 12:41 
Generalcompile error about auto_ptr Pin
George_George23-Feb-08 3:08
George_George23-Feb-08 3:08 
Hello everyone,


I am confused to read what the compiler says. Could anyone explain what it means?

#include <memory>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main( ) 
{
	int i = 0;
	
	vector<auto_ptr<int>> vc;
	for (i = 0; i < 5; i ++) // 0 1 2 3 4
	{
		auto_ptr<int> pi (new int(i));
		vc.push_back (pi);
	}

	return 0;
}


1>Compiling...
1>main.cpp
1>d:\program files\microsoft visual studio 9.0\vc\include\vector(1209) : error C2558: class 'std::auto_ptr<_Ty>' : no copy constructor available or copy constructor is declared 'explicit'
1>        with
1>        [
1>            _Ty=int
1>        ]
1>        d:\program files\microsoft visual studio 9.0\vc\include\vector(1158) : while compiling class template member function 'void std::vector<_Ty>::_Insert_n(std::_Vector_const_iterator<_Ty,_Alloc>,unsigned int,const _Ty &)'
1>        with
1>        [
1>            _Ty=std::auto_ptr<int>,
1>            _Alloc=std::allocator<std::auto_ptr<int>>
1>        ]
1>        d:\visual studio 2008\projects\test_autoptr1\test_autoptr1\main.cpp(11) : see reference to class template instantiation 'std::vector<_Ty>' being compiled
1>        with
1>        [
1>            _Ty=std::auto_ptr<int>
1>        ]
1>d:\program files\microsoft visual studio 9.0\vc\include\vector(1233) : error C2558: class 'std::auto_ptr<_Ty>' : no copy constructor available or copy constructor is declared 'explicit'
1>        with
1>        [
1>            _Ty=int
1>        ]



thanks in advance,
George
GeneralRe: compile error about auto_ptr Pin
Shog923-Feb-08 4:31
sitebuilderShog923-Feb-08 4:31 
GeneralRe: compile error about auto_ptr Pin
George_George24-Feb-08 16:10
George_George24-Feb-08 16:10 
GeneralRe: compile error about auto_ptr Pin
Shog924-Feb-08 16:26
sitebuilderShog924-Feb-08 16:26 
GeneralRe: compile error about auto_ptr Pin
George_George24-Feb-08 16:57
George_George24-Feb-08 16:57 
GeneralRe: compile error about auto_ptr Pin
Shog924-Feb-08 17:07
sitebuilderShog924-Feb-08 17:07 
GeneralRe: compile error about auto_ptr Pin
George_George24-Feb-08 17:50
George_George24-Feb-08 17:50 
GeneralRe: compile error about auto_ptr Pin
David McIntosh18-Mar-09 9:15
David McIntosh18-Mar-09 9:15 
GeneralRe: compile error about auto_ptr Pin
George_George24-Feb-08 16:58
George_George24-Feb-08 16:58 
GeneralRe: compile error about auto_ptr Pin
peterchen23-Feb-08 6:47
peterchen23-Feb-08 6:47 
GeneralRe: compile error about auto_ptr Pin
George_George24-Feb-08 16:12
George_George24-Feb-08 16:12 
GeneralRe: compile error about auto_ptr Pin
peterchen24-Feb-08 20:25
peterchen24-Feb-08 20:25 
GeneralRe: compile error about auto_ptr Pin
George_George24-Feb-08 21:05
George_George24-Feb-08 21:05 
GeneralRe: compile error about auto_ptr Pin
Mark Salsbery24-Feb-08 9:14
Mark Salsbery24-Feb-08 9:14 
GeneralRe: compile error about auto_ptr Pin
George_George24-Feb-08 16:13
George_George24-Feb-08 16:13 
Generalchange const property through overloading Pin
George_George22-Feb-08 23:18
George_George22-Feb-08 23:18 
GeneralRe: change const property through overloading Pin
Shog923-Feb-08 4:45
sitebuilderShog923-Feb-08 4:45 
GeneralRe: change const property through overloading Pin
George_George24-Feb-08 16:21
George_George24-Feb-08 16:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.