Click here to Skip to main content
15,885,309 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Cannot access the ClassView information file, ClassView information will not be available. Pin
includeh102-Apr-10 6:51
includeh102-Apr-10 6:51 
AnswerRe: Cannot access the ClassView information file, ClassView information will not be available. Pin
David Crow2-Apr-10 8:02
David Crow2-Apr-10 8:02 
QuestionParallel Port write in VC++ Pin
Sameen12-Apr-10 6:16
Sameen12-Apr-10 6:16 
AnswerRe: Parallel Port write in VC++ Pin
jeron12-Apr-10 7:30
jeron12-Apr-10 7:30 
GeneralRe: Parallel Port write in VC++ Pin
Sameen12-Apr-10 7:53
Sameen12-Apr-10 7:53 
AnswerRe: Parallel Port write in VC++ Pin
«_Superman_»2-Apr-10 15:38
professional«_Superman_»2-Apr-10 15:38 
GeneralRe: Parallel Port write in VC++ Pin
Sameen112-Apr-10 10:46
Sameen112-Apr-10 10:46 
Questionerror C2440 using adjacent_difference stl template function [modified] Pin
fda1002-Apr-10 1:35
fda1002-Apr-10 1:35 
Hi all,
I would like to use STL <numeric> adjacent_difference function in my program but I'm getting the error:

1>c:\program files\microsoft visual studio 8\vc\include\numeric(349) : error C2440: '=' : cannot convert from 'Csimple' to 'int'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called.

I have a <list> of Csimple's (udt) objects where I would calculate the differences (Csimple is a very simple class with only one int parameter called "firstInt").

list<Csimple> simpleList;
simpleList.push_back(Csimple(10)); //fill the list with Csimple's objects
...
simpleList.push_back(Csimple(25)); 
vector<int> res(simpleList.size());
vector<int>::iterator v_resItr;
v_resItr = adjacent_difference(simpleList.begin(), simpleList.end(), res.begin());

I've also added the overloaded version of operator- and operator= as class members as suggest by errors provided by compiler

Csimple Csimple::operator -(Csimple op2)
{ return firstInt - op2.firstInt; }


Csimple Csimple::operator =(Csimple op2)  
{ return firstInt = op2.firstInt; } //I'm not sure about the returned type, should be it an int?


I assume that I can use adjacent_difference also with user-defined type rather than just int; may be my assumption wrong?

Can someone help me, pls?

Many thanks in advance
modified on Friday, April 2, 2010 7:42 AM

AnswerRe: error C2440 using adjacent_difference stl template function [modified] Pin
Eugen Podsypalnikov2-Apr-10 2:54
Eugen Podsypalnikov2-Apr-10 2:54 
GeneralRe: error C2440 using adjacent_difference stl template function Pin
fda1002-Apr-10 3:20
fda1002-Apr-10 3:20 
QuestionFast 2D drawing Pin
Leif Simon Goodwin2-Apr-10 0:46
Leif Simon Goodwin2-Apr-10 0:46 
AnswerRe: Fast 2D drawing Pin
Maximilien2-Apr-10 1:34
Maximilien2-Apr-10 1:34 
GeneralRe: Fast 2D drawing Pin
Leif Simon Goodwin2-Apr-10 2:50
Leif Simon Goodwin2-Apr-10 2:50 
AnswerRe: Fast 2D drawing Pin
Graham Breach2-Apr-10 1:34
Graham Breach2-Apr-10 1:34 
GeneralRe: Fast 2D drawing Pin
Leif Simon Goodwin3-Apr-10 22:42
Leif Simon Goodwin3-Apr-10 22:42 
AnswerRe: Fast 2D drawing Pin
Iain Clarke, Warrior Programmer2-Apr-10 5:25
Iain Clarke, Warrior Programmer2-Apr-10 5:25 
GeneralRe: Fast 2D drawing Pin
Leif Simon Goodwin3-Apr-10 22:38
Leif Simon Goodwin3-Apr-10 22:38 
GeneralRe: Fast 2D drawing Pin
Leif Simon Goodwin3-Apr-10 22:44
Leif Simon Goodwin3-Apr-10 22:44 
AnswerRe: Fast 2D drawing Pin
includeh102-Apr-10 6:28
includeh102-Apr-10 6:28 
GeneralRe: Fast 2D drawing Pin
Maximilien2-Apr-10 6:41
Maximilien2-Apr-10 6:41 
AnswerRe: Fast 2D drawing Pin
Rozis3-Apr-10 12:44
Rozis3-Apr-10 12:44 
GeneralRe: Fast 2D drawing Pin
Leif Simon Goodwin3-Apr-10 22:40
Leif Simon Goodwin3-Apr-10 22:40 
QuestionAny body know about Dia2Dump SDK and its usage? Pin
glitteringsound2-Apr-10 0:34
glitteringsound2-Apr-10 0:34 
AnswerRe: Any body know about Dia2Dump SDK and its usage? Pin
Richard MacCutchan2-Apr-10 5:48
mveRichard MacCutchan2-Apr-10 5:48 
GeneralRe: Any body know about Dia2Dump SDK and its usage? Pin
glitteringsound2-Apr-10 6:44
glitteringsound2-Apr-10 6:44 

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.