Skip to content

Commit 42bbfde

Browse files
authored
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.
1 parent 3c25ce1 commit 42bbfde

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

include/boost/algorithm/is_palindrome.hpp

+2-13
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ bool is_palindrome(BidirectionalIterator begin, BidirectionalIterator end)
102102
/// \note This function will return true for empty sequences and for palindromes.
103103
/// For other sequences function will return false.
104104
/// Complexity: O(N).
105-
template <typename R, typename std::enable_if<!std::is_integral<R>::value_type>::type>
105+
template <typename R>
106106
bool is_palindrome(const R& range)
107107
{
108108
return is_palindrome(boost::begin(range), boost::end(range));
@@ -117,7 +117,7 @@ bool is_palindrome(const R& range)
117117
/// \note This function will return true for empty sequences and for palindromes.
118118
/// For other sequences function will return false.
119119
/// Complexity: O(N).
120-
template <typename R, typename Predicate, typename std::enable_if<!std::is_integral<R>::value_type>::type>
120+
template <typename R, typename Predicate>
121121
bool is_palindrome(const R& range, Predicate p)
122122
{
123123
return is_palindrome(boost::begin(range), boost::end(range), p);
@@ -161,17 +161,6 @@ bool is_palindrome(const char* str, Predicate p)
161161
return is_palindrome(str, str + strlen(str), p);
162162
}
163163

164-
bool is_palindrome (nullptr_t)
165-
{
166-
return true;
167-
}
168-
169-
template<typename T>
170-
bool is_palindrome (T)
171-
{
172-
return true;
173-
}
174-
175164
}}
176165

177166
#endif // BOOST_ALGORITHM_IS_PALINDROME_HPP

0 commit comments

Comments
 (0)