我是问题的OP:Extending a class其中我收到了很好的答案。然而,当我尝试编译代码(我的项目略有返工)我收到以下消息(线没有改变,以反映下面的示例代码。):编译器错误预期的嵌套名称说明符
except.h: | 09 | expected nested-name-specifier before ‘handler_t1’
还有更多沿着这似乎从这个干线。我是C++的新手,我对这个答案的研究(以及即将出现的问题)产生了这样一个事实:微软的编译器似乎接受了代码,但符合标准的代码却没有。
因为我现在有它的代码如下:
#include <vector>
namespace except
{
// several other classes and functions which compile and work already
// (tested and verified) have been snipped out. Entire code is over
// 1000 lines.
class Error_Handler
{
public:
using handler_t1 = bool (*)(except::Logic const&);
std::vector<handler_t1> logic_handlers;
// a lot more removed because the error has already happened ...
}
}
A至链接问题的代码的读取指示给我(我有限的知识),它应该所有的工作。
因此,我的问题是:在此声明/定义中需要更改哪些内容才能使用gcc编译(4.6.3 64位Linux编译时使用-std = C++ 0x)?
我不太了解C++ 11,但这有帮助吗? http://en.cppreference.com/w/cpp/language/type_alias –