Click here to Skip to main content
15,911,503 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Disable Task Manager for ALL users? Pin
Stephen Hewitt3-Sep-07 19:50
Stephen Hewitt3-Sep-07 19:50 
GeneralRe: Disable Task Manager for ALL users? Pin
amirreza yazdanshenas3-Sep-07 22:22
amirreza yazdanshenas3-Sep-07 22:22 
GeneralRe: Disable Task Manager for ALL users? Pin
Stephen Hewitt3-Sep-07 22:29
Stephen Hewitt3-Sep-07 22:29 
Questionmsvcrt.dll Pin
vikramlinux3-Sep-07 18:29
vikramlinux3-Sep-07 18:29 
AnswerRe: msvcrt.dll Pin
Naveen3-Sep-07 18:39
Naveen3-Sep-07 18:39 
GeneralRe: msvcrt.dll Pin
vikramlinux3-Sep-07 18:58
vikramlinux3-Sep-07 18:58 
Question[SOLVED] MoveWindow() and Negative Values [modified] Pin
Zeke8083-Sep-07 12:16
Zeke8083-Sep-07 12:16 
AnswerRe: MoveWindow() and Negative Values Pin
Mark Salsbery3-Sep-07 12:44
Mark Salsbery3-Sep-07 12:44 
GeneralRe: MoveWindow() and Negative Values Pin
Zeke8083-Sep-07 13:14
Zeke8083-Sep-07 13:14 
GeneralRe: MoveWindow() and Negative Values Pin
Mark Salsbery3-Sep-07 14:45
Mark Salsbery3-Sep-07 14:45 
GeneralRe: MoveWindow() and Negative Values Pin
Zeke8083-Sep-07 15:25
Zeke8083-Sep-07 15:25 
GeneralRe: MoveWindow() and Negative Values Pin
chandu0043-Sep-07 18:14
chandu0043-Sep-07 18:14 
QuestionHow to get a status from ITask Pin
StefanKittel3-Sep-07 10:40
StefanKittel3-Sep-07 10:40 
AnswerRe: How to get a status from ITask Pin
Hamid_RT3-Sep-07 18:52
Hamid_RT3-Sep-07 18:52 
QuestionHow to launch exe file with command line? Pin
jerome_data3-Sep-07 7:38
jerome_data3-Sep-07 7:38 
AnswerRe: How to launch exe file with command line? Pin
Mark Salsbery3-Sep-07 8:26
Mark Salsbery3-Sep-07 8:26 
AnswerRe: How to launch exe file with command line? Pin
Hamid_RT3-Sep-07 18:50
Hamid_RT3-Sep-07 18:50 
AnswerRe: How to launch exe file with command line? Pin
Jason Teagle3-Sep-07 22:37
Jason Teagle3-Sep-07 22:37 
Question860612 - automatic expand in outlining Pin
ilostmyid23-Sep-07 6:01
professionalilostmyid23-Sep-07 6:01 
QuestionProblem defining operator<(rhs) Pin
John R. Shaw3-Sep-07 5:50
John R. Shaw3-Sep-07 5:50 
When determining if the value stored in an object is less than that stored in another object we define the operator ‘<’; how it is defined is very important. But how do you define the operator for a class with multiple data items, so that you get the correct results?

For reasons that I am not going to go into, we do not care what data is stored or what its actual value is. We simply need to be able to determine whether one object is less than another for the purpose of adding it to an STL container that requires the information.

One solution is to just do a simple ‘memcmp()’ , which does work under normal usage of this particular class. The reason it works is because the ‘data_type’ is normally an integral type.

The problem is that the data type is unknown, as the class is a template and the type is supplied by the user. If the data type is a class that contains no memory pointers, the above solution will still work. But if the data type is a class that contains a memory pointer, such as a ‘std::string’, then the above solution is invalid because comparing data pointers is not the same as comparing the data pointed to.

For the purposes of comparison, every piece of data (data_, f1_,…, and id_) must be used. The ‘memcmp()’ method produces the correct results for integral types, but every other method I have tried fails. The results of the comparison must be the same as that produced by the ‘memcmp()’ method.

Note that “(data_ < rhs.data_ || f1_ < rhs.f1_ || f2_ < rhs.f2_ || f3_ < rhs.f3_ || id _ < rhs.id _)” does not work, nor other variations on that theme.

Example class:
class this_class
{
    data_type data_; // unknown data type
    bool f1_, f2_, f3_;
    int id_;
public:
    
    // Operators
    bool operator<(const this_class& rhs) const
    { return( memcmp(this,&rhs,sizeof(class)) < 0 ); }
};



INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

AnswerRe: Problem defining operator&lt;(rhs) Pin
Russell'3-Sep-07 7:05
Russell'3-Sep-07 7:05 
AnswerRe: Problem defining operator&amp;lt;(rhs) Pin
Stephen Hewitt3-Sep-07 14:58
Stephen Hewitt3-Sep-07 14:58 
GeneralRe: Problem defining operator&amp;lt;(rhs) Pin
John R. Shaw3-Sep-07 18:26
John R. Shaw3-Sep-07 18:26 
GeneralRe: Problem defining operator&amp;amp;lt;(rhs) Pin
Stephen Hewitt3-Sep-07 18:54
Stephen Hewitt3-Sep-07 18:54 
GeneralRe: Problem defining operator&amp;amp;lt;(rhs) Pin
John R. Shaw5-Sep-07 16:03
John R. Shaw5-Sep-07 16:03 

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.