12 #ifndef __KOME_CORE_SEARCH_TOOL_H__
13 #define __KOME_CORE_SEARCH_TOOL_H__
16 #include <boost/function.hpp>
47 template<
typename S,
typename T >
50 boost::function< T (
int ) > getElementFun,
51 boost::function<
int ( T, S ) > compareFun,
56 int bottom = size - 1;
60 while( top <= bottom && idx < 0 ) {
62 int mid = ( top + bottom ) / 2;
63 T elm0 = getElementFun( mid );
66 int cmp = compareFun( elm0, value );
73 T elm1 = getElementFun( mid );
74 if( compareFun( elm1, value ) == 0 ) {
101 #endif // __KOME_CORE_SEARCH_TOOL_H__