mirror of
https://github.com/boostorg/algorithm.git
synced 2025-07-06 01:06:37 +02:00
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:
@ -102,7 +102,7 @@ bool is_palindrome(BidirectionalIterator begin, BidirectionalIterator end)
|
|||||||
/// \note This function will return true for empty sequences and for palindromes.
|
/// \note This function will return true for empty sequences and for palindromes.
|
||||||
/// For other sequences function will return false.
|
/// For other sequences function will return false.
|
||||||
/// Complexity: O(N).
|
/// 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)
|
bool is_palindrome(const R& range)
|
||||||
{
|
{
|
||||||
return is_palindrome(boost::begin(range), boost::end(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.
|
/// \note This function will return true for empty sequences and for palindromes.
|
||||||
/// For other sequences function will return false.
|
/// For other sequences function will return false.
|
||||||
/// Complexity: O(N).
|
/// 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)
|
bool is_palindrome(const R& range, Predicate p)
|
||||||
{
|
{
|
||||||
return is_palindrome(boost::begin(range), boost::end(range), 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);
|
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
|
#endif // BOOST_ALGORITHM_IS_PALINDROME_HPP
|
||||||
|
Reference in New Issue
Block a user