non-member function ‘size_t capacity()’ cannot have cv-qualifier
字面意思是非成员函数不能定义cv限定符,比如说friend函数,就不能加const和valitale。
functions.cc:60:18: error: non-member function ‘size_t capacity()’ cannot have cv-qualifier
60 | size_t capacity()const
| ^~~~~
functions.cc: In function ‘size_t capacity()’:
functions.cc:62:9: error: ‘cap’ was not declared in this scope
62 | return cap - elements;
| ^~~
functions.cc:62:15: error: ‘elements’ was not declared in this scope
62 | return cap - elements;
| ^~~~~~~~
今天是因为定义了一个非成员函数的函数吗?但是自己看却是加了类限定符的,class_name::,而且函数没有半点错误,找半天原来多定义了一次成员函数,第二个成员函数没问题,但是第一个,没有加类名限定符(却加了const),所以系统报错。真是百密一疏呀。
non-member function ‘size_t capacity()’ cannot have cv-qualifier相关推荐
- [C++]Call virtual member function in constructor or destructor
嗷嗷按,今天被问到在constructor/destructor中调用virtual member function的问题.答错了,很羞耻. 依稀记得在constructor/destructor调用 ...
- error: reference to non-static member function must be called sort(nums.begin(),nums.end(),cmp1)
leetcode179题中编译出现则个问题 出错的代码: class Solution { public:bool cmp1(const int& a, const int& b){s ...
- call to member function bind_param() on boolean...........
Fatal error: Uncaught Error: Call to a member function bind_param() on boolean in .... Stack trace: ...
- 提示illegal reference to data member'CPMAgentManageDlg::m_matrixMatrixSt'in a static member function
当提示"illegal reference to data member'CPMAgentManageDlg::m_matrixMatrixSt'in a static member fun ...
- 出现错误illegal call of non-static member function?
当出现错误"illegal call of non-static member function"? 解决方法:原因在于没有经过对象,就调用了非静态成员函数,只有静态成员函数(st ...
- c++ 静态类成员函数(static member function) vs 名字空间 (namespace)
好多人喜欢把工具函数做成static member function.这样以增加隐蔽性和封装性,由其是从C#,java转而使用c++的开发人员. 例如: class my_math { public: ...
- NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. ...
- warning C4183: ‘Cricle‘: member function definition looks like a ctor, but name does not match enclo
报错:warning C4183: 'Cricle': member function definition looks like a ctor, but name does not match en ...
- C/C++编程:reference to non-static member function must be called
主要原因是我使用了函数指针,而函数指针所指函数须得是静态才行 错误代码: class Solution {public:string ReverseSentence(string str) {type ...
最新文章
- php 字符串替换 正则表达式,PHP中一些可以替代正则表达式函数的字符串操作函数...
- enum类型被intent所携带时需要注意的地方
- Linux服务器集群系统(二)--转
- Python中文件的介绍以及操作
- Java21-day12【网络编程(网络编程入门(ip地址、端口、协议、InetAddress)、UDP通信程序、TCP通信程序)】
- Android stduio之Plugin with id ‘com.android.application‘ not found解决办法
- 新手也能学会本地调试微信,natapp 官网映射
- 给mysql salve从库复制授权_MySQL主从复制
- OpenGL网络资源
- CPC客户端从写作到提交成功的巨坑
- 苹果计算机显示错误怎么按,教你解决苹果电脑装windows7提示磁盘分区错误的方法...
- JAVA 用户登录图形验证码
- 荣耀30会更新鸿蒙系统吗,华为荣耀30肿么升级鸿蒙系统?
- python绘制五角星
- 【Tomcat】一分钟教你eclipse如何配置tomcat(二)
- 市场调研很难做?这些软件帮你理清思绪
- 2021-6-9-今日收获
- 收集需求的方法:群体创新技术
- java 开发微型公众账号应用
- Intel Realsense D435iL515 驱动安装
热门文章
- 初识canvas,使用canvas做一个百分比加载进度的动画
- 算法导论-排序(四)计数排序(线性时间排序)
- weblogic(CVE-2018-2628漏洞复现)
- 网站开发之MyEclipse简单实现JSP网页表单提交及传递值
- HarmonyOS之常用组件ToastDialog的功能和使用
- 信息学奥赛一本通(C++)在线评测系统——基础(一)C++语言——1092:求出e的值
- Java IO流 、 Properties 、 枚举
- 【Tools】Visual Studio 2019专业版下载和安装
- 【Tools】TeamViewer安装教程
- 【Android】 Android中适配器简介