I am playing with unique_ptr. In my last post people helped me compiling a program that used this pointer by specifying the -std=c++0x during compilation. Now i was wondering if
The "memory" header (probably found at /usr/include/c++/4.9/memory) only includes "unique_ptr.h" and "shared_ptr.h" (probably found at /usr/include/c++/4.9/bits/unique_ptr.h and /usr/include/c++/4.9/bits/shared_ptr.h) if the macro "__cplusplus" is equal or greather than "201103L". Check memory.h for yourself to see the "#if" preprocessor condition there, at line 69 (or search for the string "#if __cplusplus >= 201103L").
As others mentioned, compiling with "-std=c++0x" or later c++ standards (-std=c++11 or -std=c++14) solves the compilation errors, but not the eclipse indexing and autocomplete problem.
To solve the eclipse indexing issue I added the "__cplusplus" Preprocessor Macro to the project build properties, with the value "201103L", and afterwards I refreshed the index;
To add the preprocessor macro:
"right click the project on project explorer" >> properties >> C/C++ General >> Preprocessor Includes >> Entries >> GNU C++ >> CDT User Settings Entries >> Add... >> Preprocessor Macro;
Then entry a macro with name "__cplusplus" and value "201103L";
Afterwards, to refresh the index, do:
"right click project on project explorer" >> Index >> Rebuild;
Ps.: I was using gcc 4.9.2 and eclipse Luna (4.4.2), on ubuntu 15.04 64bits