初始化中的双'=' [英] double '=' in initialization

查看:72
本文介绍了初始化中的双'='的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我做一些劳动时,我碰到了这条线:

I came across this line when I was doing some laborations:

 int home_address = current_pos_ = hash(key, size_);

我想知道它的实际作用是什么? (不是哈希函数或其他任何东西,只是"int variable = variable = value;"之类的东西)

And I was wondering what it actually does? (not the hashfunction or anything, just the "int variable = variable = value;" thing)

推荐答案

该表达式的读取方式为:

That expression is read as:

int home_address = (current_pos_ = hash(key,size_));

它将hash(key,size_)的结果分配给current_pos_,然后将current_pos_的值分配给home_address.

It assigns the result of hash(key,size_) into current_pos_ and it then assigns the value of current_pos_ into home_address.

这篇关于初始化中的双'='的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆