瀏覽代碼

Attempt at a fix for comparing extern structs.

Mark Sibly 9 年之前
父節點
當前提交
63a95b87a9
共有 1 個文件被更改,包括 7 次插入3 次删除
  1. 7 3
      modules/monkey/native/bbtypes.h

+ 7 - 3
modules/monkey/native/bbtypes.h

@@ -45,9 +45,13 @@ namespace detail{
 
 bbString bbTypeName( const char *type );
 
-template<class X,class Y> int bbCompare( X x,Y y ){
-	if( y>x ) return -1;
-	return x>y;
+template<class T> bool operator<( const T &x,const T &y ){
+	return memcmp( &x,&y,sizeof(T) );
+}
+
+template<class X,class Y> int bbCompare( const X &x,const Y &y ){
+	if( x<y ) return -1;
+	return y<x;
 }
 
 #endif