Click here to Skip to main content
15,888,527 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralgetExitCodeProcess Pin
ns17-Aug-04 7:22
ns17-Aug-04 7:22 
GeneralRe: getExitCodeProcess Pin
David Crow17-Aug-04 9:31
David Crow17-Aug-04 9:31 
GeneralRe: getExitCodeProcess Pin
Ryan Binns17-Aug-04 19:20
Ryan Binns17-Aug-04 19:20 
Generalserial link question (COM port on pC) Pin
jetournier17-Aug-04 7:02
jetournier17-Aug-04 7:02 
GeneralRe: serial link question (COM port on pC) Pin
valikac17-Aug-04 7:33
valikac17-Aug-04 7:33 
GeneralNeed help CListCtrl Pin
Metatron_17-Aug-04 6:47
Metatron_17-Aug-04 6:47 
GeneralRe: Need help CListCtrl Pin
Ravi Bhavnani17-Aug-04 7:21
professionalRavi Bhavnani17-Aug-04 7:21 
GeneralSTL problem Pin
BeerBelly17-Aug-04 6:25
BeerBelly17-Aug-04 6:25 
Can someone tell me why this code will not compile?

#include<vector>

class Pair{
public:
int a,b,count;
public:
Pair();
Pair(Pair& pP);
Pair(int pA,int pB,int pCt=1);
Pair& operator =(Pair& pP);
bool operator ==(Pair pP);
void operator ++(){++count;}
};

Pair::Pair(){a=b=count=0;}

Pair::Pair(Pair& pP){
a = pP.a;
b = pP.b;
count = pP.count;
}

Pair::Pair(int pA,int pB,int pCt){
a = pA;
b = pB;
count = pCt;
}

Pair& Pair::operator =(Pair& pP){
a=pP.a;b=pP.b;count=pP.count;return *this;
}

bool Pair::operator ==(Pair pP){
return (((a==pP.a)||(a==pP.b))&&(b==pP.a||b==pP.b));
}


template <class t="">
class VSet : public std::vector<t>{
public:
void add(T pT);
};

template <class t="">
void VSet<t>::add(T pT){
iterator i = begin();
while (i != end()){
if((*i)==pT){++(*i);return;}
++i;
}
push_back(pT);
}

void TestFunct(VSet<pair> *pV){
Pair P(1,2);
pV->add(P);
}


The line : push_back(pT)
seems to be the problem, if I comment it out it compiles fine.

I am using VCC 6.0

The 2 errors I get are :

error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'const class Pair' (or there is no acceptable conversion)

and

error C2558: class 'Pair' : no copy constructor available

Any help would be greatly appreciated.
GeneralRe: STL problem Pin
Jeff Bogan17-Aug-04 7:18
Jeff Bogan17-Aug-04 7:18 
GeneralRe: STL problem Pin
digwizfox17-Aug-04 12:59
digwizfox17-Aug-04 12:59 
GeneralRe: STL problem Pin
Ryan Binns17-Aug-04 19:28
Ryan Binns17-Aug-04 19:28 
GeneralRe: STL problem Pin
digwizfox17-Aug-04 7:43
digwizfox17-Aug-04 7:43 
GeneralRe: STL problem Pin
Jeff Bogan17-Aug-04 9:36
Jeff Bogan17-Aug-04 9:36 
GeneralRe: STL problem Pin
digwizfox17-Aug-04 12:51
digwizfox17-Aug-04 12:51 
GeneralRe: STL problem Pin
peterchen17-Aug-04 10:56
peterchen17-Aug-04 10:56 
GeneralRe: STL problem Pin
BeerBelly17-Aug-04 19:02
BeerBelly17-Aug-04 19:02 
QuestionHow to Start With C++? Pin
Dody_DK17-Aug-04 6:13
Dody_DK17-Aug-04 6:13 
AnswerRe: How to Start With C++? Pin
Watever_417-Aug-04 6:23
Watever_417-Aug-04 6:23 
AnswerRe: How to Start With C++? Pin
Maximilien17-Aug-04 6:35
Maximilien17-Aug-04 6:35 
GeneralRe: How to Start With C++? Pin
Dody_DK17-Aug-04 6:39
Dody_DK17-Aug-04 6:39 
GeneralRe: How to Start With C++? Pin
Ravi Bhavnani17-Aug-04 7:28
professionalRavi Bhavnani17-Aug-04 7:28 
AnswerRe: How to Start With C++? Pin
valikac17-Aug-04 7:36
valikac17-Aug-04 7:36 
AnswerRe: How to Start With C++? Pin
peterchen17-Aug-04 11:38
peterchen17-Aug-04 11:38 
Questioncan a dll use the mfc? Pin
Anonymous17-Aug-04 6:06
Anonymous17-Aug-04 6:06 
AnswerRe: can a dll use the mfc? Pin
sojijolan17-Aug-04 6:46
susssojijolan17-Aug-04 6:46 

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.