I have a problem when I compile my code.
template<class InputIterator, class UnaryPredicate>
bool all_of (InputIterator first, InputIterator last, UnaryPredicate pred)
{
while (first!=last) {
if (!pred(*first)) return false;
++first;
}
return true;
}
I took the code from http://www.cplusplus.com/reference/algorithm/all_of/?kw=all_of.
I'm using Code::blocks 12.11 and I have the following errors:
C:\Users\PC-HP\Desktop\chiffre\romain\main.cpp||In instantiation of 'bool all_of(InputIterator, InputIterator, UnaryPredicate) [with InputIterator = __gnu_cxx::__normal_iterator >; UnaryPredicate = bool (*)(std::basic_string)]':|
C:\Users\PC-HP\Desktop\chiffre\romain\main.cpp|84|required from here|
C:\Users\PC-HP\Desktop\chiffre\romain\main.cpp|13|error: invalid conversion from 'char' to 'const char*' [-fpermissive]|
c:\program files\codeblocks\mingw\bin..\lib\gcc\mingw32\4.7.1\include\c++\bits\basic_string.tcc|214|error: initializing argument 1 of 'std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator]' [-fpermissive]|
||=== Build finished: 2 errors, 2 warnings (0 minutes, 1 seconds) ===|
line 84:
while(!all_of(romain.begin(), romain.end(), IsRoman))
There is my entire code: http://pastebin.com/k0KYNB6H
I don't use c++11
.
romain
? – Joseph Mansfield