Click here to Skip to main content
15,905,322 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Remove help button on CPropertySheet Pin
Member 42425923-Sep-03 21:31
Member 42425923-Sep-03 21:31 
GeneralRe: Remove help button on CPropertySheet Pin
murali_utr23-Sep-03 22:19
murali_utr23-Sep-03 22:19 
GeneralDLL Registeration Issue Pin
fadee23-Sep-03 19:20
fadee23-Sep-03 19:20 
GeneralRe: DLL Registeration Issue Pin
geo_m23-Sep-03 21:09
geo_m23-Sep-03 21:09 
GeneralRe: DLL Registeration Issue Pin
fadee23-Sep-03 21:48
fadee23-Sep-03 21:48 
GeneralRe: DLL Registeration Issue Pin
1.5kg23-Sep-03 22:28
1.5kg23-Sep-03 22:28 
GeneralRe: DLL Registeration Issue Pin
fadee23-Sep-03 23:36
fadee23-Sep-03 23:36 
GeneralNeed help for STL Pin
zma6423-Sep-03 18:43
zma6423-Sep-03 18:43 
Confused | :confused: Directly comaring 2 vectors is pretty good.
However, if we try to compare 2 vectors in a class, problem ocurs.
Please see the following code.


#include<iostream>
#include<vector>

using namespace std;

class A
{
public:
typedef vector<int> vect;
private:
vect v;
public:
A(int dim, int* a)
{
v.reserve(dim);
copy(a,a+dim, v.begin());
}

// what's wrong here
bool operator==(const A& other) const
{
//cout<<v[0]<<','<<v[1]<<endl;
cout<<other.v[0]<<','<<other.v[1]<<endl;
="" return="" v="=" other.v;=""
="" }

};

void="" main()
{
="" initiate="" 2="" arrays
="" int="" a[2]="{1,2};
" b[2]="{2,2};

" cout<<"******="" vector="" compare="" ******\n";
="" vector<int=""> v1(a,a+2);
vector<int> v2(b,b+2);
if(v1==v2)cout<<" equal\n";
else cout<<"not equal\n";

cout<<"****** class A compare ******\n";
A object1(2,a);
A object2(2,b);
if(object1 == object2) cout<<" equal\n";
else cout<<"not equal\n";
}

run:
****** vector compare ******
not equal // OK, (1,2) not_equal_to (2,2)
****** class A compare ******
equal // oops (1,2) equal_to (2,2), Jesus knows???




zma64
GeneralRe: Need help for STL Pin
Joaquín M López Muñoz23-Sep-03 20:14
Joaquín M López Muñoz23-Sep-03 20:14 
GeneralThanks Pin
Anonymous24-Sep-03 3:30
Anonymous24-Sep-03 3:30 
QuestionDo you write &quot;precondition&quot; and &quot;postcondition&quot; in your comment? Pin
Link260023-Sep-03 18:27
Link260023-Sep-03 18:27 
AnswerRe: Do you write &quot;precondition&quot; and &quot;postcondition&quot; in your comment? Pin
Michael Dunn23-Sep-03 18:46
sitebuilderMichael Dunn23-Sep-03 18:46 
GeneralRe: Do you write &quot;precondition&quot; and &quot;postcondition&quot; in your comment? Pin
Link260023-Sep-03 18:55
Link260023-Sep-03 18:55 
GeneralRe: Do you write &quot;precondition&quot; and &quot;postcondition&quot; in your comment? Pin
David Crow24-Sep-03 2:22
David Crow24-Sep-03 2:22 
GeneralRe: Do you write &quot;precondition&quot; and &quot;postcondition&quot; in your comment? Pin
Link260024-Sep-03 12:15
Link260024-Sep-03 12:15 
GeneralRe: Do you write &quot;precondition&quot; and &quot;postcondition&quot; in your comment? Pin
David Crow25-Sep-03 9:44
David Crow25-Sep-03 9:44 
GeneralQuestion about mmap Pin
George223-Sep-03 16:55
George223-Sep-03 16:55 
GeneralHooking keyboard events not working on Win98 Pin
tommyfotak23-Sep-03 16:53
tommyfotak23-Sep-03 16:53 
GeneralPlatform SDK Pin
esepich23-Sep-03 15:58
esepich23-Sep-03 15:58 
GeneralRe: Platform SDK Pin
David Stone23-Sep-03 16:10
sitebuilderDavid Stone23-Sep-03 16:10 
GeneralPointer to Function for Phase Management Pin
wogerdoger23-Sep-03 15:38
wogerdoger23-Sep-03 15:38 
GeneralRe: Pointer to Function for Phase Management Pin
David Crow23-Sep-03 16:32
David Crow23-Sep-03 16:32 
GeneralCheers Pin
wogerdoger23-Sep-03 17:31
wogerdoger23-Sep-03 17:31 
GeneralWarning: The wheels have fallen off the camel Pin
wogerdoger24-Sep-03 9:04
wogerdoger24-Sep-03 9:04 
GeneralFinding hardware Device Infomation... Pin
Member 40481323-Sep-03 15:25
Member 40481323-Sep-03 15:25 

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.