Index: src/libcfa/stdlib
===================================================================
--- src/libcfa/stdlib	(revision e672372dcffd6ac8335882a71d5b294e036bda92)
+++ src/libcfa/stdlib	(revision 853451bf01109989a343f4c8c712cf9eecae442c)
@@ -10,6 +10,6 @@
 // Created On       : Thu Jan 28 17:12:35 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Dec 23 18:21:42 2017
-// Update Count     : 267
+// Last Modified On : Thu Dec 28 18:43:12 2017
+// Update Count     : 277
 //
 
@@ -185,13 +185,18 @@
 //---------------------------------------
 
-forall( otype T | { int ?<?( T, T ); } )
-T * bsearch( T key, const T * arr, size_t dim );
-
-forall( otype T | { int ?<?( T, T ); } )
-unsigned int bsearch( T key, const T * arr, size_t dim );
-
-
-forall( otype T | { int ?<?( T, T ); } )
-void qsort( const T * arr, size_t dim );
+forall( otype E | { int ?<?( E, E ); } )
+E * bsearch( E key, const E * arr, size_t dim );
+
+forall( otype E | { int ?<?( E, E ); } )
+unsigned int bsearch( E key, const E * arr, size_t dim );
+
+forall( otype K, otype E | { int ?<?( K, K ); K getKey( E & ); } )
+E * bsearch( K key, const E * arr, size_t dim );
+
+forall( otype K, otype E | { int ?<?( K, K ); K getKey( E & ); } )
+unsigned int bsearch( K key, const E * arr, size_t dim );
+
+forall( otype E | { int ?<?( E, E ); } )
+void qsort( E * arr, size_t dim );
 
 //---------------------------------------
Index: src/libcfa/stdlib.c
===================================================================
--- src/libcfa/stdlib.c	(revision e672372dcffd6ac8335882a71d5b294e036bda92)
+++ src/libcfa/stdlib.c	(revision 853451bf01109989a343f4c8c712cf9eecae442c)
@@ -10,6 +10,6 @@
 // Created On       : Thu Jan 28 17:10:29 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sun Dec 24 13:00:15 2017
-// Update Count     : 344
+// Last Modified On : Thu Dec 28 18:43:16 2017
+// Update Count     : 378
 //
 
@@ -128,20 +128,32 @@
 //---------------------------------------
 
-forall( otype T | { int ?<?( T, T ); } )
-T * bsearch( T key, const T * arr, size_t dim ) {
-	int comp( const void * t1, const void * t2 ) { return *(T *)t1 < *(T *)t2 ? -1 : *(T *)t2 < *(T *)t1 ? 1 : 0; }
-	return (T *)bsearch( &key, arr, dim, sizeof(T), comp );
+forall( otype E | { int ?<?( E, E ); } )
+E * bsearch( E key, const E * arr, size_t dim ) {
+	int comp( const void * t1, const void * t2 ) { return *(E *)t1 < *(E *)t2 ? -1 : *(E *)t2 < *(E *)t1 ? 1 : 0; }
+	return (E *)bsearch( &key, arr, dim, sizeof(E), comp );
 } // bsearch
 
-forall( otype T | { int ?<?( T, T ); } )
-unsigned int bsearch( T key, const T * arr, size_t dim ) {
-	T * result = bsearch( key, arr, dim );
-	return result ? result - arr : dim;					// pointer subtraction includes sizeof(T)
+forall( otype E | { int ?<?( E, E ); } )
+unsigned int bsearch( E key, const E * arr, size_t dim ) {
+	E * result = bsearch( key, arr, dim );
+	return result ? result - arr : dim;					// pointer subtraction includes sizeof(E)
 } // bsearch
 
-forall( otype T | { int ?<?( T, T ); } )
-void qsort( const T * arr, size_t dim ) {
-	int comp( const void * t1, const void * t2 ) { return *(T *)t1 < *(T *)t2 ? -1 : *(T *)t2 < *(T *)t1 ? 1 : 0; }
-	qsort( arr, dim, sizeof(T), comp );
+forall( otype K, otype E | { int ?<?( K, K ); K getKey( E & ); } )
+E * bsearch( K key, const E * arr, size_t dim ) {
+	int comp( const void * t1, const void * t2 ) { return *(K *)t1 < getKey( *(E *)t2 ) ? -1 : getKey( *(E *)t2 ) < *(K *)t1 ? 1 : 0; }
+	return (E *)bsearch( &key, arr, dim, sizeof(E), comp );
+} // bsearch
+
+forall( otype K, otype E | { int ?<?( K, K ); K getKey( E & ); } )
+unsigned int bsearch( K key, const E * arr, size_t dim ) {
+	E * result = bsearch( key, arr, dim );
+	return result ? result - arr : dim;					// pointer subtraction includes sizeof(E)
+} // bsearch
+
+forall( otype E | { int ?<?( E, E ); } )
+void qsort( E * arr, size_t dim ) {
+	int comp( const void * t1, const void * t2 ) { return *(E *)t1 < *(E *)t2 ? -1 : *(E *)t2 < *(E *)t1 ? 1 : 0; }
+	qsort( arr, dim, sizeof(E), comp );
 } // qsort
 
