13 template<
typename t_container,
typename t_compare,
typename t_param>
17 return m_compare(m_container[p_index],m_param);
20 : m_container(p_container), m_compare(p_compare), m_param(p_param)
29 template<
typename t_container,
typename t_compare,
typename t_param,
typename t_permutation>
33 return m_compare(m_container[m_permutation[p_index]],m_param);
36 : m_container(p_container), m_compare(p_compare), m_param(p_param), m_permutation(p_permutation)
47 template<
typename t_container,
typename t_compare,
typename t_param>
48 bool bsearch_t(
t_size p_count,
const t_container & p_container,t_compare p_compare,
const t_param & p_param,
t_size & p_index) {
55 template<
typename t_container,
typename t_compare,
typename t_param,
typename t_permutation>
56 bool bsearch_permutation_t(
t_size p_count,
const t_container & p_container,t_compare p_compare,
const t_param & p_param,
const t_permutation & p_permutation,
t_size & p_index) {
63 p_index = p_permutation[index];
70 template<
typename t_container,
typename t_compare,
typename t_param>
79 t_size base = probe, count = 1;
80 while(base > 0 && p_compare(p_container[base-1],p_param) == 0) {base--; count++;}
81 while(base + count < p_count && p_compare(p_container[base+count],p_param) == 0) {count++;}
83 p_range_count = count;
const t_container & m_container
bsearch_callback_impl_permutation_t(const t_container &p_container, t_compare p_compare, const t_param &p_param, const t_permutation &p_permutation)
int test(t_size p_index) const
bool bsearch_range_t(const t_size p_count, const t_container &p_container, t_compare p_compare, const t_param &p_param, t_size &p_range_base, t_size &p_range_count)
bsearch_callback_impl_simple_t(const t_container &p_container, t_compare p_compare, const t_param &p_param)
bool bsearch_permutation_t(t_size p_count, const t_container &p_container, t_compare p_compare, const t_param &p_param, const t_permutation &p_permutation, t_size &p_index)
const t_container & m_container
int test(t_size p_index) const
const t_permutation & m_permutation
bool bsearch_t(t_size p_count, const t_container &p_container, t_compare p_compare, const t_param &p_param, t_size &p_index)
bool bsearch(t_size p_count, bsearch_callback const &p_callback, t_size &p_result)