dicards qualifiers

从零开始:小鼠Bulk RNA-seq全流程实战指南 本文提供了一份详尽的小鼠Bulk RNA-seq全流程实战指南,涵盖从软件环境搭建、原始数据质控与清洗、序列比对、基因定量到下游差异表达分析与功能富集。内容面向生物信息学新手,通过清晰的代码示例和步骤解析,帮助读者系统掌握Bulk RNA-seq数据分析的核心技能,并产出可靠的生物学洞见。 阅读详情

stl_vector.h:43: error: passing ‘const vector<int, __default_alloc_template<false, 0> >’ as ‘this’ argument of ‘T* vector<T, Alloc>::begin() [with T = int, Alloc = __default_alloc_template<false, 0>]’ discards qualifiers


这个是我看了侯大师的STL源码剖析后,自己模仿实现vector时出现的错误

相关的代码

iterator begin(){return start;}

iterator end(){return finish;}

size_type size()const

{

return size_type(end() - begin());

}

产生discards qualifiers类错误可能原因如下

Usual Causes
1. A non-const member function is being invoked for a const object
2. A const object is being passed as a non-const parameter
3. A const member function calls a non-const member function

在这是我是用一个 const修饰的size调用了非const方法 begin() 和end() 虽然我在size()中并没有修改什么内容,但编译是不通过的,从编译的角度就杜绝你可能通过调用非const方法来间接 修改。

其实侯大师的书里,为了简介把源码去掉了很多内容 我就傻了吧唧的敲上去了。。。

去看了一下库里的


库里有相应的const版的begin 和end 供const方法调用的



(借用几点别人的总结):

关于Const函数的几点规则:

  const对象只能访问const成员函数,而非const对象可以访问任意的成员函数,包括const成员函数.
  const对象的成员是不可修改的,然而const对象通过指针维护的对象却是可以修改的.
  const成员函数不可以修改对象的数据,不管对象是否具有const性质.它在编译时,以是否修改成员数据为依
据,进行检查





【OpenCV】图像的像素直方图 图像特征点 cv::FAST cv::ORB ORB_SLAM2::ORB 文章目录图像直方图代码实现cv::FAST和cv::ORB 检测图像特征点cv::FAST和cv::ORB 检测图像特征点代码实现ORB_SLAM2::ORB和自己实现ORB图像特征点检测效果对比ORB_SLAM2::ORB和自己实现ORB图像特征点检测效果对比代码实现 图像直方图代码实现 图像是由不同数值(颜色)的像素构成的,像素值在图像中的分布情况是图像的重要属性,可以用直方图修改图像的外观,标识图像的内容,检测图像中特定的物体或纹理。 单通道灰度图像中每个像素都有一个 0(黑色)-255(白色)的整 阅读详情

相关推荐

深入了解torch框架

大国的游戏,政府支持到位,是未来;AI : Artificial Intelligence,旨在研究、开发能够模拟、延伸和扩展人类智能的理论、方法、技术及应用系统,是一种拥有自主学习和推理能力的技术。它模仿人类大脑某些功能,包括感知、学习、理解、决策和问题解决。AI本质​ NLP(说话,听)、CV(眼睛)、自动驾驶、机器人(肢体动作)、大模型三要素:数据、网络、算力① 神经网络:找到合适的数学公式;② 训练:用已有数据训练网络,目标是求最优解;③ 推理:用模型预测新样本;PyTorch,简称Torch

qq_74732076的博客 1135

c++ error: passing ‘const xxx’ as ‘this’ argument discards qualifiers

const 对象只能访问const成员函数。

noevil的博客 869

CATIA二次开发实战:我用VBA写了个BOM表自动导出工具,效率提升80%

本文详细介绍了如何利用VBA进行CATIA二次开发,构建BOM表自动导出工具的全过程。通过智能解析算法、异常处理机制和性能优化技巧,该工具将BOM表生成时间从2.5小时缩短至8分钟,效率提升80%。文章还探讨了与PDM系统集成和定制化报告生成等扩展应用,为机械设计工程师提供了实用的自动化解决方案。

weixin_33709590的博客 555

警告"warning: type qualifiers ignored on function return type"

我用的时候,使用的是: 定义: const uint16_t getfun(void){int a = 1; return a }; 使用: uint16_t num = getfun(); 这时,会告诉你,类型限定符const,在函数返回时被忽视了。   因为你返回的是一个局部变量的值. 没有使用引用,也没有使用指针,你使用const其实没有意义的。所以编译器自动给你忽略了。 如

xijun的专栏 1万+

gnuradio+b210实现FM收音机

gnuradio+b210实现FM收音机环境介绍FM接收1 Flow Graph2 变量参数FM发射1 Flow Graph 环境介绍 Name Version gnuradio 3.7.14.0 uhd 3.15.0.0 ubuntu 18.04 usrp b210 参考 https://www.ijedr.org/papers/IJEDR1702038.pdf Audio File Transmission using GNURADIO and USRP FM接

u011745228的博客 5126

Arduino平台软硬件原理及使用——Arduino Uno板卡的使用

Arduino Uno板卡的基本使用

洪博hopes的博客 4173

编写无警告的代码

今天把项目的Qt版本从Qt4.6.3升级到Qt4.8.4,重新编译项目代码的时候,特别关注了一下编译器的警告。于是找到《C++编程规范——101条规则、准则与最佳实践》翻了翻,重温了一下第1条 在高级别警告干净利落地进行编译。      如果编译器对某个构造发出警告,一般表明代码中存有潜在的问题。警告就好比代码的“肿瘤”,可能是良性的也可能是恶性的——作为代码医生的我们不能对其视而不见。必须“把

e5Max的专栏 7636

UG\NX二次开发 替换部件引用集UF_ASSEM_replace_refset

替换部件引用集UF_ASSEM_replace_refset,需要替换成“完整部件(Entire Part)”需要第三个参数传入空指针或者空字符串。

王牌飞行员_里海的博客 253

warning C4090: 'initializing' : different 'const' qualifiers

在编译一段程序时提示了如标题的警告,查找资料之后发现是关于只读变量定义的问题.在C语言的程序里,我们会这样定义,以表示该参数只读.int functionName(const int *param){  int *temp = param;    //此处提示警告  //函数体} 因为此步赋值操作两边的对应变量类型不一致。虽然左侧变量无法修改右侧变量值。但是此警

lopper的专栏 6517

RTDETR最强结构图 | 包含模型整体结构图 | 全模块展开图 | AiFi模块展开图

RT-DETR 最全结构图

Coding... 9597

fast-lio系列改进版本

2.回环检测的优化结果,更新到FAST-LIO2的当前帧位姿中,幷进行ikdtree的重构,进而更新submap。其它的效果还不清楚,实测lio部分稳定性很好。用fast-lio_slam就很稳定。融合了fast-lio2和sc-pgo,两部分分开运行,SC-PGO从FAST-LIO2节点获取里程计和激光雷达点云主题。的作者kim在FAST-LIO2的基础上,添加SC-PGO模块,通过加入ScanContext全局描述子,进行回环修正,SC-PGO模块与FAST-LIO2解耦,非常方便,很优秀的工作。

z1872385的博客 3189

passing '' as 'this' argument discards qualifiers [-fpermissive]

本文主要参考了 const放置的位置   https://blog.youkuaiyun.com/caojunhao123/article/details/43699873 C++编译程序出现了这个错误“passing '' as 'this' argument discards qualifiers [-fpermissive]” 其实主要原因还是在const这个限定符上 ,代码中从父类继承来的纯虚...

Pabebe的博客 2万+

打开电脑自动弹窗问题:无法为文件‘D:\Config.Msi\*.rbf‘设置文件安全。错误:5。请确认...如何解决?| 提供多种解决方案,亲测有效!

🏆本文收录于 《全栈Bug调优(实战版)》 专栏,该专栏专注于分享我在真实项目开发中遇到的各类疑难Bug及其深层成因,并系统提供高效、可复现的解决思路和实操方案。无论你是刚入行的新手开发者,还是拥有多年项目经验的资深工程师,本专栏都将为你提供一条系统化、高质量的问题排查与优化路径,助力你加速成长,攻克技术壁垒,迈向技术价值最大化与职业发展的更高峰🚀!

**My Coding Family** 2912

gcc编译报 “discards qualifiers [-fpermissive]”

https://blog.youkuaiyun.com/xidwong/article/details/52754514

qq_37405874的博客 416

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

passing ‘const XXX’ as ‘this’ argument discards qualifiers

错误分析 错误代码: // DataPointBase.h class DataPointBase { public: DataPointBase() = default; explicit DataPointBase(std::vector<std::string> &_keys); std::vector<std::string> Keys() const; double &operator[](const std::string&

Feiyuemoxuan的博客 3442

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

关于passing ‘const *’ as ‘this’ argument of ‘*’ discards qualifiers的问题

class Rectangle { public: string what(); friend ostream& operator <<(ostream& os,const Rectangle &object); }; ostream& operator << (ostream& os,const Rectangle& object) { os << object.what() <<":

yshwaker的专栏 1万+

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

passing 'const xxx ' as 'this' argument discards qualifiers [-fpermissive]

文章目录什么情况原因 什么情况 如果写出如下代码 class A { public: A(int h = 0) : height(h) {} int getHeight() { return height; } private: int height; }; int main(int argc, char* argv[]) { const A a; int height = a.ge...

creambean的博客 1万+

gcc version is very high

when compile android 4.0 , when gcc version 4.6.3 is very high, it will show error message below, It must use gcc version 4.4 . -------------------------------------------------------------------

1537

【C++】error: passing ‘const xxx’ as ‘this’ argument discards qualifiers [-fpermissive]

1、错误信息分析 error: passing ‘const xxx’ as ‘this’ argument discards qualifiers [-fpermissive] 直译:错误:将“const xxx”作为“this”参数传递会丢弃限定词。 discards qualifiers:丢弃限定符,当尝试修改const类型时,会报discards qualifiers -fpermiss...

郭老二 4万+

解决办法: error: passing ‘const VideoFrame’ as ‘this’ argument discards qualifiers [-fpermissive]

  有以下错误: void process(const VideoFrame* pFrame) { pFrame-&gt;saveToJpeg(); } 编译时出错: error: passing ‘const VideoFrame’ as ‘this’ argument discards qualifiers [-fpermissive]   原因是参数作为const。修改如下...

柳鲲鹏 2881

error: passing ‘const xxx’ as ‘this’ argument discards qualifiers [-fpermissive]的解决方案

先上错误: ../include/rectangle.h:Ininstantiationof'R_START_TREE::Rectangle<dimensions>&R_START_TREE::Rectangle<dimensions>::operator=(constR_START_TREE::Rectangle<dimensions>&)[withlonglongunsignedintdimensions=3]': r...

jinking01的专栏 5775

为什么会出现discard qualifiers错误

const 对象调用对象的非const函数会触发这个编译错误

boshuzhang的专栏 1317

discard qualifiers的错误

写代码时,没有注意到或者说不清楚的问题,discard qualifiers的问题,网上有人碰到此类问题并附介绍: For my compsci class, I am implementing a Stack template class, but have run into an odd error: Stack.h: In member function ‘const T

wofly_0909的专栏 2590

c++ discards qualifiers

在c++编译的时候,会出现discards qualifiers的错误提示这个错误的表示代码中,尝试修改const的变量,例如:1,给const的类成员赋值class person {private:    int age;public:    const int&amp; getAge() const    {        return age;    }    void setAge(con...

hongyd的博客 1万+

类型函数(type function)

在C和C++中,我们常见的是值函数(value function),即函数接收的参数是某些值,而且函数的返回结果也是值。 至于类型函数(type function),即函数接收某些类型的实参,并生成一个类型作为函数的返回结果。 例子: 1、内建函数sizeof就是一个类型函数,它返回一个描述给定类型实参大小的常量。 2、类模板也可以作为类型函数。类型函数的参数可以是模板的参数,类型函数的返...

xunye的博客 6350

c++编译时出现discards qualifiers [-fpermissive]的错误

代码: class HasPtr{ public: HasPtr(const string &amp;s = string()):ps(new string(s)),i(0){} HasPtr(const HasPtr &amp;p){ ps = new string(p.getPs()); i = p.i; } const s...

zhiyuanjiang的博客 6798
上一篇: <为什么>要有virtual,及如何理解晚捆绑
下一篇: 我所理解的红黑树删除
github_24924857
博客等级 码龄12年 16粉丝 26原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值