template < typename T > auto Find(const T& value, std::_List_iterator first, std::_List_iterator last) { while (!(*first == value) && first != last) { first++; } return first; } template < typename T, typename RIterator > RIterator Binary(const T& value, RIterator first, RIterator last) { if(first == last) return first; RIterator mid = first + (last - first) / 2; if(*mid < value) return Binary(value, mid + 1, last); else return Binary(value, first, mid); } template < typename T, typename Iterator > Iterator Find(const T& value, Iterator first, Iterator last) { Iterator res = Binary(value, first, last); if (!(*res == value)) return last; return first; }