I came to this somewhat picturesque solution:
#include <string>
bool is_palindromic(const std::string& s)
{
std::string::const_iterator start = s.begin();
std::string::const_iterator end = s.end();
while (start < end) {
if (*(start++) != *(--end)) {
return false;
}
}
return true;
}
...that doesn't handle the empty string in a specific way, but as palindromic.