Deleted support for nullptr, NULL and 0.

I think user shouldn't send to 'is_palindrome' zero, NULL or nullptr as parameter. As value of const char* it's possible, of course. But cases 'is_palindrome(0)', 'is_palindrome(NULL)' and 'is_palindrome(nullptr)' is silly and it should be restricted by design.
This commit is contained in:
Alexander
2016-08-16 16:18:21 +03:00
committed by GitHub
parent 3c25ce1090
commit 42bbfdeb4c

View File

@ -102,7 +102,7 @@ bool is_palindrome(BidirectionalIterator begin, BidirectionalIterator end)
/// \note This function will return true for empty sequences and for palindromes.
/// For other sequences function will return false.
/// Complexity: O(N).
template <typename R, typename std::enable_if<!std::is_integral<R>::value_type>::type>
template <typename R>
bool is_palindrome(const R& range)
{
return is_palindrome(boost::begin(range), boost::end(range));
@ -117,7 +117,7 @@ bool is_palindrome(const R& range)
/// \note This function will return true for empty sequences and for palindromes.
/// For other sequences function will return false.
/// Complexity: O(N).
template <typename R, typename Predicate, typename std::enable_if<!std::is_integral<R>::value_type>::type>
template <typename R, typename Predicate>
bool is_palindrome(const R& range, Predicate p)
{
return is_palindrome(boost::begin(range), boost::end(range), p);
@ -161,17 +161,6 @@ bool is_palindrome(const char* str, Predicate p)
return is_palindrome(str, str + strlen(str), p);
}
bool is_palindrome (nullptr_t)
{
return true;
}
template<typename T>
bool is_palindrome (T)
{
return true;
}
}}
#endif // BOOST_ALGORITHM_IS_PALINDROME_HPP