-3

My doubt is that does "auto" keyword works in C++4.3.2? I was writing a program to check the presence of a prefix in a word, I wrote something like this --

auto res = mismatch(prefix,word);

And when I compiled it gave the error--

res was not declared in scope

What should I use in place of "auto" in case if "auto" is not available in c++4.3.2.

Here u can see my full code-- http://paste.ubuntu.com/9351873/

gsdf
  • 275
  • 1
  • 6
  • 13
  • If only there were some sort of [page](https://gcc.gnu.org/projects/cxx0x.html) that had a list of features and when they were addded... – user657267 Dec 03 '14 at 02:36
  • For a given definition of "works", it works. See what version of the C++ standard (and features like "auto") is supported by your compiler version (assuming gnu c++) here: https://gcc.gnu.org/projects/cxx0x.html – michael Dec 03 '14 at 03:00
  • `4.3.2` appears to be a version of `g++`, a particular C++ compiler. There is no version `4.3.2` of the C++ *language*. – Keith Thompson Dec 03 '14 at 03:17

2 Answers2

0

@Surayans Tiwari

Return type of mismatch() is std::pair. Please refer following page and correct your usage.

http://en.cppreference.com/w/cpp/algorithm/mismatch

Steephen
  • 14,645
  • 7
  • 40
  • 47
0

I have the same opinion with @KeithThompson that you are talking about using GCC 4.3.2 instead of using C++ 4.3.2.

Assume that I perceive correctly, the compilation error that you got is due to the auto type is not supported in GCC 4.3.2 yet.

According to the C++11 support in GCC reference,
https://gcc.gnu.org/projects/cxx0x.html
the auto-typed variables is supported since GCC 4.4.

If you wish to try the feature of auto type, you should use a newer GCC compiler.

Biboo Chung
  • 121
  • 1
  • 2
  • 13