这段代码出了什么问题,为什么我得错了答案:
class X
{
private:
const int a;
const int& b;
public:
X(): a(10) , b(20)
{
// std::cout << "constructor : a " << a << std::endl;
// std::cout << "constructor : b " << b << std::endl;
}
void display()
{
std::cout << "display():a:" << a << std::endl;
std::cout << "display():b:" << b << std::endl;
}
};
int
main(void)
{
X x;
x.display();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
上面的代码会给我结果
display():a:10
display():b:1104441332
Run Code Online (Sandbox Code Playgroud)
但是如果我删除默认构造函数中的注释2行,它给出了正确的结果
constructor : a 10
constructor : b 20 …Run Code Online (Sandbox Code Playgroud) 我正在尝试运行ansible-plabook,但它在设置时挂起.我的剧本做了很多工作,如调用不同的角色和模块,它也收集事实.它过去工作得很好,但现在我不知道出了什么问题,任何帮助表示赞赏
我跑的命令是
ansible-playbook -i /tmp/tmpBo5Xmj -vvvvv playbook.yml -c ssh
Run Code Online (Sandbox Code Playgroud)
这是详细日志
TASK [setup] *******************************************************************
<172.17.239.193> ESTABLISH SSH CONNECTION FOR USER: ansible
<172.17.239.193> SSH: ansible.cfg set ssh_args: (-o)(UserKnownHostsFile=/dev/null)(-o)(StrictHostKeyChecking=no)
<172.17.239.193> SSH: ANSIBLE_HOST_KEY_CHECKING/host_key_checking disabled: (-o)(StrictHostKeyChecking=no)
<172.17.239.193> SSH: ansible_password/ansible_ssh_pass not set: (-o)(KbdInteractiveAuthentication=no)(-o)(PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey)(-o)(PasswordAuthentication=no)
<172.17.239.193> SSH: ANSIBLE_REMOTE_USER/remote_user/ansible_user/user/-u set: (-o)(User=ansible)
<172.17.239.193> SSH: ANSIBLE_TIMEOUT/timeout set: (-o)(ConnectTimeout=10)
<172.17.239.193> SSH: PlayContext set ssh_common_args: ()
<172.17.239.193> SSH: PlayContext set ssh_extra_args: ()
<172.17.239.193> SSH: EXEC ssh -C -vvv -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o …Run Code Online (Sandbox Code Playgroud) 我有一个变量type,我想使用内置type()函数
例
def fun(inv):
log.debug('type of inv {}'.format(type(inv)))
type = 'int'
Run Code Online (Sandbox Code Playgroud)
运行该函数时出现以下错误:
AttributeError: 'module' object has no attribute 'type'
Run Code Online (Sandbox Code Playgroud)