小编Red*_*ift的帖子

通过指针向量迭代

我正试图通过玩家手牌迭代.

Player.cpp

vector<Card*>::iterator iter;
    for(iter = current_cards.begin(); iter != current_cards.end(); iter++) {
        cout << iter->display_card() << endl;
    }
Run Code Online (Sandbox Code Playgroud)

它在

cout << iter->display_card() << endl;
Run Code Online (Sandbox Code Playgroud)

目前提出"错误:表达式必须具有指针类型".

同样,current_cards声明为:

vector<Card*>current_cards;
Run Code Online (Sandbox Code Playgroud)

此外,display_card()方法很简单:

Card.cpp

string Card::display_card(){
    stringstream s_card_details;
    s_card_details << "Colour: " << card_colour << "\n";
    s_card_details << "Type: " << card_type << "\n";

    return s_card_details.str();
}
Run Code Online (Sandbox Code Playgroud)

我已经查看了各种资源,并且针对类似问题提出的所有建议都没有对我有用.谢谢你的帮助!

c++ pointers vector object

15
推荐指数
2
解决办法
3万
查看次数

无法安装nodejs-legacy

我正在尝试遵循教程并遇到Node.js安装问题.在Debian VM上安装,并在nodejs站点上运行建议的安装命令:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejson 
Run Code Online (Sandbox Code Playgroud)

当我运行sudo apt-get install nodejs-legacy它给我这个错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve …
Run Code Online (Sandbox Code Playgroud)

debian install node.js

6
推荐指数
1
解决办法
3198
查看次数

如何更改谷歌图表工具提示的弹出位置

我目前有启用html的工具提示,也显示"子图".但是,如果可以将所有工具提示弹出到固定位置或者具有调整其相对位置的偏移量,那将是很好的.

在此输入图像描述

这是我有一种工具提示的例子(空白数据).我想把它移到右边.任何建议将不胜感激,包括任何javascript技巧.

html javascript google-visualization

2
推荐指数
2
解决办法
9042
查看次数