我在类中找到了这行代码,我必须修改它:
::Configuration * tmpCo = m_configurationDB;//pointer to current db
Run Code Online (Sandbox Code Playgroud)
而且我不知道究竟是什么意思是双重冒号前面的类名.没有它我会读:声明tmpCo作为指向类的对象的指针Configuration...但前面的双冒号混淆了我.
我还发现:
typedef ::config::set ConfigSet;
Run Code Online (Sandbox Code Playgroud) 最近我见过如下例子:
#include <iostream>
class Foo {
public:
int bar;
Foo(int num): bar(num) {};
};
int main(void) {
std::cout << Foo(42).bar << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这奇怪: bar(num)意味着什么?它似乎初始化成员变量,但我以前从未见过这种语法.它看起来像一个函数/构造函数调用,但对于一个int?对我没有任何意义.也许有人可以启发我.而且,顺便说一下,还有其他类似的深奥语言功能,你永远不会在一本普通的C++书中找到它吗?
template <int>
using A = int;
void f(A<0>=0); // Attempting to declare a function f taking int,
// with the default argument 0
// Works as expected:
// void f(A<0> = 0);
Run Code Online (Sandbox Code Playgroud)
这既不适用于GCC 4.9.2也不适用于Clang 3.5 - 更不用说ICC或VC++了.显然,该>=位被解析为大于或等于运算符.但是,对于[temp.names]/3,这似乎是不正确的:
名称查找(3.4)后发现名称是模板名称或者operator-function-id或literal-operator-id引用一组重载函数,其中任何成员都是函数模板,如果遵循此函数通过a
<,<始终将其视为template-argument-list的分隔符,而不是less-than运算符. 在解析模板参数列表时,第一个非嵌套>138被视为结束分隔符而不是大于运算符.[..] [ 例如:Run Code Online (Sandbox Code Playgroud)template<int i> class X { /* ...*/ }; X< 1>2 > x1; // syntax error X<(1>2)> x2; // …