C++11 (0x)? [message #722704] |
Tue, 06 September 2011 14:51 |
Hannes Steffenhagen Messages: 1 Registered: September 2011 |
Junior Member |
|
|
Does parsing C++0x/C++11 still not work correctly?
#include <iostream>
#include <string>
#include <functional>
class Printer
{
public:
typedef std::function<void(void)> PrintHandle; /*Symbol 'function' could not be resolved*/
void setEventHandler(PrintHandle event);
void triggerEvent();
const Printer& operator=(const Printer&)=delete;
Printer(const Printer&)=delete;
Printer()=default;
private:
PrintHandle handle;
};
void Printer::setEventHandler(Printer::PrintHandle event)
{
handle = event;
}
void Printer::triggerEvent()
{
handle();
}
using namespace std;
int main() {
Printer printer;
std::string hello{"Hello World"};
printer.setEventHandler([=](){std::cout<<hello<<std::endl;}); /*Invalid Arguments 'Candidates are void setEventHandler(?) '*/
printer.triggerEvent();
return 0;
}
I mean, it doesn't show me any syntax errors at the lambda expression which would be weird if CDT didn't support C++0x at all - but why doesn't the parser recognize "function"?
PS: I did google for this, but the newest relevant information I could find was from 2009.
PPS: It seems I just answered my own question. If even something like is considered valid syntax by the parser it definitely does support 0x. So there appears to be some bug that prevents function from being parsed - I just checked the header, it definitely contains template<typename _Signature>
class function;
Ok it seems that rather than a problem with C++0x, it is a problem with template types in the std namespace in general... std::vector is also not being recognized - wtf?
It appears to be some problem with the indexer - if I add the headers to the "index up-front" list at least the STL containers are recognized. std::function still isn't though.
[Updated on: Wed, 07 September 2011 09:58] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03716 seconds