84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
hash_map<string, list<uint32_t> > g_hmLimits;...list<uint32_t>& lsErrorTime = g_hmLimits[strDomain]; lsErrorTime.clear();为什么返回值是:list<uint32_t>& 类型呢?hash_map中的value存储的是一个list对象,并不是对象的指针,这个时候返回的Value是原来Value的副本吗?
光阴似箭催人老,日月如移越少年。
先强调一点,hash_map不是C++标准库的东西,没有通行的标准,一下所说都是基于C++11的unordered_map而言的。在unordered_map中重载[]操作符的定义为
mapped_type& operator[] ( const key_type& k ); mapped_type& operator[] ( key_type&& k );
可以看到,这里返回的就是引用,所以用引用来接受是没有问题的。
先强调一点,hash_map不是C++标准库的东西,没有通行的标准,一下所说都是基于C++11的unordered_map而言的。
在unordered_map中重载[]操作符的定义为
可以看到,这里返回的就是引用,所以用引用来接受是没有问题的。