#include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string foo = "123";
if(count_if(foo.begin(), foo.end(), isdigit) == foo.size())
{
cout << "\nGreat!\n";
}
cin.get()
}
Does not work on bloodshed v4.9.9.2!!!
It outputs the following error:
no matching function for call to `count_if(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, <unknown type>)'
But it does work on VC++ Express 2005... (obviously including stdafx.h)