Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comparing two GUIDs for equality in C++

I am looking for the easiest way to compare two GUIDs for equality in C++. Surely there is a predefined function for that.

The solution needs to work with Visual C++ 2010.

I am talking of GUID as defined in Guiddef.h:

typedef struct _GUID {
    unsigned long  Data1;
    unsigned short Data2;
    unsigned short Data3;
    unsigned char  Data4[ 8 ];
} GUID;
like image 207
Helge Klein Avatar asked Aug 06 '12 20:08

Helge Klein


2 Answers

Perhaps you want IsEqualGUID (which uses memcmp behind the scenes) or just use operator== (which calls IsEqualGUID for you).

like image 68
Jesse Good Avatar answered Oct 04 '22 01:10

Jesse Good


Is the == operator not overloaded to do this for you? Or use IsEqualGUID.

like image 22
Science_Fiction Avatar answered Oct 03 '22 23:10

Science_Fiction