[libgee] Assure get_equal_func_for behavies correctly for Comparable



commit 1da0489a1ef3f4f78fa2cbc945dcdb6437c04af3
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date:   Sat Aug 21 20:33:58 2010 +0200

    Assure get_equal_func_for behavies correctly for Comparable

 gee/functions.vala |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gee/functions.vala b/gee/functions.vala
index dc173ea..d77719e 100644
--- a/gee/functions.vala
+++ b/gee/functions.vala
@@ -49,6 +49,8 @@ namespace Gee {
 		public static EqualDataFunc get_equal_func_for (Type t) {
 			if (t == typeof (string)) {
 				return (a, b) => {return str_equal ((string) a, (string) b);};
+			} else if (t.is_a (typeof (Comparable))) {
+				return (a, b) => {return ((Comparable<Comparable>) a).compare_to ((Comparable) b) == 0;};
 			} else {
 				return (a, b) => {return direct_equal (a, b);};
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]