/usr/include/boost/algorithm
NameSizeModeActions
cxx11/-0755rm
cxx14/-0755rm
cxx17/-0755rm
searching/-0755rm
string/-0755rm
algorithm.hpp24210644editdlrm
apply_permutation.hpp45120644editdlrm
clamp.hpp79170644editdlrm
find_backward.hpp25230644editdlrm
find_not.hpp9860644editdlrm
gather.hpp41640644editdlrm
hex.hpp131220644editdlrm
is_palindrome.hpp42790644editdlrm
is_partitioned_until.hpp25760644editdlrm
minmax.hpp12810644editdlrm
minmax_element.hpp174880644editdlrm
sort_subrange.hpp36110644editdlrm
string.hpp10610644editdlrm
string_regex.hpp7300644editdlrm
Edit: /usr/include/boost/algorithm/is_palindrome.hpp (4279B)
/* Copyright (c) Alexander Zaitsev , 2016 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) See http://www.boost.org/ for latest version. */ /// \file is_palindrome.hpp /// \brief Checks the input sequence on palindrome. /// \author Alexander Zaitsev #ifndef BOOST_ALGORITHM_IS_PALINDROME_HPP #define BOOST_ALGORITHM_IS_PALINDROME_HPP #include #include #include #include #include #include namespace boost { namespace algorithm { /// \fn is_palindrome ( BidirectionalIterator begin, BidirectionalIterator end, Predicate p ) /// \return true if the entire sequence is palindrome /// /// \param begin The start of the input sequence /// \param end One past the end of the input sequence /// \param p A predicate used to compare the values. /// /// \note This function will return true for empty sequences and for palindromes. /// For other sequences function will return false. /// Complexity: O(N). template bool is_palindrome(BidirectionalIterator begin, BidirectionalIterator end, Predicate p) { if(begin == end) { return true; } --end; while(begin != end) { if(!p(*begin, *end)) { return false; } ++begin; if(begin == end) { break; } --end; } return true; } /// \fn is_palindrome ( BidirectionalIterator begin, BidirectionalIterator end ) /// \return true if the entire sequence is palindrome /// /// \param begin The start of the input sequence /// \param end One past the end of the input sequence /// /// \note This function will return true for empty sequences and for palindromes. /// For other sequences function will return false. /// Complexity: O(N). template bool is_palindrome(BidirectionalIterator begin, BidirectionalIterator end) { return is_palindrome(begin, end, std::equal_to::value_type> ()); } /// \fn is_palindrome ( const R& range ) /// \return true if the entire sequence is palindrome /// /// \param range The range to be tested. /// /// \note This function will return true for empty sequences and for palindromes. /// For other sequences function will return false. /// Complexity: O(N). template bool is_palindrome(const R& range) { return is_palindrome(boost::begin(range), boost::end(range)); } /// \fn is_palindrome ( const R& range, Predicate p ) /// \return true if the entire sequence is palindrome /// /// \param range The range to be tested. /// \param p A predicate used to compare the values. /// /// \note This function will return true for empty sequences and for palindromes. /// For other sequences function will return false. /// Complexity: O(N). template bool is_palindrome(const R& range, Predicate p) { return is_palindrome(boost::begin(range), boost::end(range), p); } /// \fn is_palindrome ( const char* str ) /// \return true if the entire sequence is palindrome /// /// \param str C-string to be tested. /// /// \note This function will return true for empty sequences and for palindromes. /// For other sequences function will return false. /// Complexity: O(N). bool is_palindrome(const char* str) { if(!str) return true; return is_palindrome(str, str + strlen(str)); } /// \fn is_palindrome ( const char* str, Predicate p ) /// \return true if the entire sequence is palindrome /// /// \param str C-string to be tested. /// \param p A predicate used to compare the values. /// /// \note This function will return true for empty sequences and for palindromes. /// For other sequences function will return false. /// Complexity: O(N). template bool is_palindrome(const char* str, Predicate p) { if(!str) return true; return is_palindrome(str, str + strlen(str), p); } }} #endif // BOOST_ALGORITHM_IS_PALINDROME_HPP