1#include <iostream>
2using namespace std;
3
4inline bool endsWith(string const &value, string const &ending)
5{
6 if (ending.size() > value.size()) return false;
7 return equal(ending.rbegin(), ending.rend(), value.rbegin());
8}
9
10int main() {
11 string teststring = "This should return true because the string ends with a period.";
12 string ending = ".";
13
14 cout << endsWith(teststring, ending);
15}