Remove inlines from things in binary_find

This commit is contained in:
Henrique Gemignani Passos Lima 2022-12-07 19:18:48 +02:00
parent 572777596d
commit a92bb98810
4 changed files with 12 additions and 9 deletions

View File

@ -115,7 +115,7 @@ It lower_bound(It start, It end, const T& value, Cmp cmp) {
}
template < typename It, typename T, typename Cmp >
inline It binary_find(It start, It end, const T& value, Cmp cmp) {
It binary_find(It start, It end, const T& value, Cmp cmp) {
It lower = lower_bound(start, end, value, cmp);
bool found = false;
if (lower != end && !cmp(value, *lower)) {
@ -158,13 +158,13 @@ inline pair_sorter_finder< T::value_type, less< select1st< typename T::value_typ
}
template < typename K, typename V, typename Cmp >
inline bool pair_sorter_finder< pair< K, V >, Cmp >::operator()(const K& a,
bool pair_sorter_finder< pair< K, V >, Cmp >::operator()(const K& a,
const pair< K, V >& b) const {
return cmp(a, b.first);
}
template < typename K, typename V, typename Cmp >
inline bool pair_sorter_finder< pair< K, V >, Cmp >::operator()(const pair< K, V >& a,
bool pair_sorter_finder< pair< K, V >, Cmp >::operator()(const pair< K, V >& a,
const K& b) const {
return cmp(a.first, b);
}
@ -175,7 +175,7 @@ find_by_key(const T& container,
const typename select1st< typename T::value_type >::value_type& key);
template < typename T >
typename T::const_iterator inline find_by_key(
typename T::const_iterator find_by_key(
const T& container, const typename select1st< typename T::value_type >::value_type& key) {
return binary_find(container.begin(), container.end(), key,
default_pair_sorter_finder<T>());

View File

@ -10,9 +10,12 @@ struct identity {
template < typename T >
struct less {
bool operator()(const T& a, const T& b) const { return a < b; }
bool operator()(const T& a, const T& b) const; // { return a < b; }
};
template < typename T >
bool less<T>::operator()(const T& a, const T& b) const { return a < b; }
} // namespace rstl
#endif // _RSTL_FUNCTIONAL

View File

@ -21,7 +21,7 @@ typename It::difference_type __distance(It first, It last, forward_iterator_tag)
}
template < typename It >
inline typename It::difference_type distance(It first, It last) {
typename It::difference_type distance(It first, It last) {
return __distance(first, last, typename It::iterator_category());
}
@ -33,7 +33,7 @@ void __advance(It& it, S count, forward_iterator_tag) {
}
template < typename It, typename S >
inline void advance(It& it, S count) {
void advance(It& it, S count) {
return __advance(it, count, typename It::iterator_category());
}

View File

@ -128,12 +128,12 @@ struct const_counting_iterator {
};
template < typename It >
inline typename It::difference_type __distance(It first, It last, random_access_iterator_tag) {
typename It::difference_type __distance(It first, It last, random_access_iterator_tag) {
return last - first;
}
template < typename It, typename S >
inline void __advance(It& it, S count, random_access_iterator_tag) {
void __advance(It& it, S count, random_access_iterator_tag) {
it += count;
}