当前位置:网站首页>Can go struct in go question bank · 15 be compared?
Can go struct in go question bank · 15 be compared?
2022-06-30 18:55:00 【GolangRoadmap】
*「 title 」GOLANG ROADMAP Community
*
「 answer 」(engine)
It needs to be analyzed in detail , If struct Contains field types that cannot be compared , Can't be compared , If struct All field types in support of comparison , Then it can be compared .
A type that cannot be compared : ① slice, because slice Is a reference type , Unless it's with nil Compare ② map, and slice Empathy , If you want to compare two map Can only be achieved by loop traversal ③ Function type
Other types can be compared .
There are two other points to note :
Structures can only compare whether they are equal , Instead of comparing their sizes . Only structures with equal attributes and consistent attribute order can be compared .
边栏推荐
- [零基础学IoT Pwn] 环境搭建
- Vscode status bar statusbar
- 《被讨厌的勇气:“自我启发之父”阿德勒的哲学课》
- Dlib library for face key point detection (openCV Implementation)
- Tensorflow2 ten must know for deep learning
- Advanced customization of uni app [day13]
- TiDB Dashboard里面可以写sql执行吗
- MySQL找不到mysql.sock文件的臨時解
- 屏幕显示技术进化史
- 医疗行业企业供应链系统解决方案:实现医疗数智化供应链协同可视
猜你喜欢

详解单例模式

Volcano engine was selected into the first "panorama of edge computing industry" in China

C# Winform程序界面优化实例

Hospital online consultation applet source code Internet hospital source code smart hospital source code

Vulnerability recurrence ----37. Apache unomi Remote Code Execution Vulnerability (cve-2020-13942)

Dlib库实现人脸关键点检测(Opencv实现)

Dependencies tool to view exe and DLL dependencies

Four tips tell you how to use SMS to promote business sales?

The online procurement system of the electronic components industry accurately matches the procurement demand and leverages the digital development of the electronic industry

Troubleshooting MySQL for update deadlock
随机推荐
Vs Code treeview TreeView
冰河老师的书
火山引擎入选国内首个《边缘计算产业全景图》
Deep learning compiler understanding
挖财账号开户安全吗?是靠谱的吗?
What if icloud photos cannot be uploaded or synchronized?
MRO工业品采购管理系统:赋能MRO企业采购各节点,构建数字化采购新体系
C# Winform程序界面优化实例
ONEFLOW source code parsing: automatic inference of operator signature
Another CVPR 2022 paper was accused of plagiarism, and Ping An insurance researchers sued IBM Zurich team
Sword finger offer 16 Integer power of numeric value
The online procurement system of the electronic components industry accurately matches the procurement demand and leverages the digital development of the electronic industry
Solution of enterprise supply chain system in medical industry: realize collaborative visualization of medical digital intelligent supply chain
torch stack() meshgrid()
Tensorflow2 深度学习十必知
MySQL transaction concurrency and mvcc mechanism
Tensorflow2 深度学习十必知
MySQL事务并发问题和MVCC机制
「杂谈」对数据分析未来的几点思考
视频内容生产与消费创新