gpt4 book ai didi

c++ - Visual Studio 2012 中的智能感知 : No members available for Inner classes in class template?

转载 作者:行者123 更新时间:2023-11-30 02:56:14 30 4
gpt4 key购买 nike

我想知道为什么在 Visual Studio 2012 桌面中键入:

    struct a
{
struct b
{
int foo;
};

b bar;
bar.
};

IntelliSense 调用:“没有可用的成员”。 IE。当我输入“酒吧”时。在结构 a 中。我的问题是 - 这是 Visual Studio 2012 错误,还是我的愚蠢?对我来说,这很烦人,我祈祷能解决这个问题。

编辑:虽然我那样写代码的时候装傻了,但是即使在函数中我仍然有这个问题。但我想出了一个大要求——它必须是类模板。所以真正的代码是:

    template<typename def>
class lista
{
private:
struct wezel
{
int poprz;
};
wezel* current;
public:
void do_tylu()
{
current->
}
};

然后 IntelliSense 开始崩溃......

最佳答案

在示例中,您在方法(或字段初始值设定项)之外键入表达式。这在 C++ 中是不允许的,因此 IntelliSense 算法无法提供有用的信息。

请尝试以下操作:

struct a
{
struct b
{
int foo;
};

b bar;

void SomeMethod()
{
bar.
}
};

关于c++ - Visual Studio 2012 中的智能感知 : No members available for Inner classes in class template?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15794802/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com