template < typename T, typename Iterator > Iterator Search(const T& value, Iterator first, 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) { bool check = std::is_same, Iterator>::value; std::cout << check << "\n"; if (check == true) { return Search(value, first, last); } else { Iterator res = Binary(value, first, last); if (!(*res == value)) return last; return first; } }