幕府将军mutex errorr C2664: “clear”: 不能将参数 1 从“std::vector<_Ty>”转换为“std::vector<_Ty>”

error&C2664:&“std::_Vector_iterator&_Ty,_Alloc&&std::vector&_Ty&::erase&(std::_Vector_iterator&
&m_vCenterPoints.erase(m_vCenterPoints.a(i));
m_PetList定义 std::vector
&CHARACTER::PET_CLIENT_DATA&
提示错误 error C2664:
“std::_Vector_iterator&_Ty,_Alloc&
std::vector&_Ty&::erase
(std::_Vector_iterator&_Ty,_Alloc&)”:
不能将参数 1 从“CHARACTER::_tagPET_CLIENT_DATA
*”转换为“std::_Vector_iterator&_Ty,_Alloc&”
_Ty=CHARACTER::PET_CLIENT_DATA,
_Alloc=std::allocator&CHARACTER::PET_CLIENT_DATA&
无构造函数可以接受源类型,或构造函数重载决策不明确
修改后:&m_vCenterPoints.erase(m_vCenterPoints.begin()+i);
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。“std::vector&_Ty&::_Make_iter”: 超出修饰名的长度,名称被截断//多维容器使用这个警告有什么危害_百度知道
“std::vector&_Ty&::_Make_iter”: 超出修饰名的长度,名称被截断//多维容器使用这个警告有什么危害
#include &vector&#include &string&int main(){int vlen1=2,vlen2=3,vlen3=4,vlen4=5;vector&vector&vector&vector&string& & & & vect4(vlen4,vector&vector&vector&string& & &(vlen3,vector&vector&string& &(vlen2,vector&string&(vlen1))));vect4.resize(10);} warning C4503: “std::vector&_Ty&::_Make_iter”: 超出修饰名的长度,名称被截断1&
_Ty=std::vector&std::vector&std::vector&std::string&&&1&
提问者采纳
这种Warning应该没有问题的。不过为了可读性和维护,建议用一些 typedef 过渡一下。
typedef 怎么过渡呀?
#include &vector&#include &string& typedef vector&string& VEC_1;typedef vector&VEC_1& VEC_2;typedef vector&VEC_2& VEC_3;typedef vector&VEC_3& VEC_4; void tt(){ long vlen4=5, vlen3=4, vlen2=3, vlen1=2; VEC_4
vect4(vlen4,VEC_3(vlen3,VEC_2(vlen2,VEC_1(vlen1)))); vect4.resize(10);}
哥哥,还是那个错误!名称被截断 是那个名称被截断了呀,数据元素?
VS2010编译没有问题。其他不知。
来自团队:
其他类似问题
为您推荐:
其他3条回答
哇,容器嵌套2层在以后有工作就够用了,什么功能让你需要嵌套这么多层啊,估计提示的警告就在这
我知道 ,这个警告 会让四维的数据丢失吗?
没试过,真不知道,你可以设置断点调试一下这里嘛,应该可以看出有什么变化
啊!警告 还能调试啊???”: 超出修饰名的长度,名称被截断
//元素被截断了嘛?
警告啊,又不是错误,当然可以调试啊
不会调试啊,大哥 你调试下试试 好吧
额,我这调试没有警告,看了半天没搞懂这个容器的作用来,还是好好研究嵌套一层容器来的实在啊
你的编译是?我用dev-c++没问题。
struct V1{
typedef std::vector&std::string& VEC;}; struct V2{
typedef std::vector&V1& VEC;}; struct V3{
typedef std::vector&V2& VEC;}; struct V4{
typedef std::vector&V3& VEC;}; V4 (v=VS.80).aspx
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁用心创造滤镜
扫码下载App
汇聚2000万达人的兴趣社区下载即送20张免费照片冲印
扫码下载App
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
I hope it works.
See also: CT2A macro, WideCharToMultiByte function.
其他办法:CString,char*,const&char&*,LPCTSTR&的转换如何将CString类型的变量赋给char*类型的变量1、GetBuffer函数:使用CString::GetBuffer函数。char *p;CString str="hello";p=str.GetBuffer(str.GetLength());str.ReleaseBuffer();
将CString转换成char * 时CString str("aaaaaaa");strcpy(str.GetBuffer(10),"aa");str.ReleaseBuffer();当我们需要字符数组时调用GetBuffer(int n),其中n为我们需要的字符数组的长度.使用完成后一定要马上调用ReleaseBuffer();还有很重要的一点就是,在能使用const char *的地方,就不要使用char *
2、memcpy: CString mCS=_T("cxl");char mch[20];memcpy(mch,mCS,20);
3、用LPCTSTR强制转换: 尽量不使用char *CSch=(LPSTR)(LPCTSTR)
CString str = "good";char *sprintf(tmp,"%s",(LPTSTR)(LPCTSTR)str);
4、CString MMsg=Msg+"abc";LPTSTRlpsz = new TCHAR[Msg.GetLength()+1];_tcscpy(lpsz, Msg);char *strcpy(psz,lpsz);
CString类向const char *转换char a[100];CString str("aaaaaa");strncpy(a,(LPCTSTR)str,sizeof(a));或者如下:strncpy(a,str,sizeof(a));以上两种用法都是正确地. 因为strncpy的第二个参数类型为const char *.所以编译器会自动将CString类转换成const char *.
CString转LPCTSTR (const char *)CString cSconst char *lpctStr=(LPCTSTR)cS
LPCTSTR转CStringLPCTSTR lpctSCString cStr=lpctS
将char*类型的变量赋给CString型的变量可以直接赋值,如: CString myString = "This is a test";也可以利用构造函数,如: CString s1("Tom");
将CString类型的变量赋给char []类型(字符串)的变量1、sprintf()函数CString str = "good";char tmp[200] ;sprintf(tmp, "%s",(LPCSTR)str);&&(LPCSTR)str这种强制转换相当于(LPTSTR)(LPCTSTR)strCString类的变量需要转换为(char*)的时,使用(LPTSTR)(LPCTSTR)str
然而,LPCTSTR是const char *,也就是说,得到的字符串是不可写的!将其强制转换成LPTSTR去掉const,是极为危险的!一不留神就会完蛋!要得到char *,应该用GetBuffer()或GetBufferSetLength(),用完后再调用ReleaseBuffer()。
2、strcpy()函数CSchar c[256];strcpy(c, str);
char mychar[1024];CString source="Hello";strcpy((char*)&mychar,(LPCTSTR)source);
阅读(6367)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_087',
blogTitle:'error C2664: “gethostbyname”: 不能将参数 1 从“CString”转换为“const char *”',
blogAbstract:'error C2664: “gethostbyname”: 不能将参数 1 从“CString”转换为“const char *”— 最快解决方法',
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:0,
publishTime:7,
permalink:'blog/static/',
commentCount:0,
mainCommentCount:0,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'',
hmcon:'1',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}C++中关于类数据成员的初始值,在vs2013中报错_百度知道
C++中关于类数据成员的初始值,在vs2013中报错
class Screen{public: typedef std::string::size_ Screen() = Screen(pos ht, pos wd) :height(ht), width(wd), contents(ht * wd, ' '){} Screen(pos ht, pos wd, char c) :height(ht), width(wd), contents(ht * wd, c){}private: pos height = 0, width = 0; std::};class Window_mgr{private: std::vector&Screen& screens{ Screen(24, 80, ' ' };// 1&f:\c++primer\screen\screen\usescreen.cpp(5): error C2664: “std::vector&Screen,std::allocator&_Ty&&::vector(std::initializer_list&Screen&,const std::allocator&_Ty& &)”: 无法将参数 1 从“Screen”转换为“const std::allocator&_Ty& &”};代码完全按照书本上写的 为什么会出现这个错误,如果不给成员赋值又是可以通过编译的,vs2013应该支持给成员赋初始值的呀
提问者采纳
#include&&iostream&#include&&vector&using&namespace&class&Screen&{public: typedef&std::string::size_type& Screen()&{}&//&=& Screen(pos&ht,&pos&wd)&:height(ht),&width(wd),&contents(ht&*&wd,&'&'){} Screen(pos&ht,&pos&wd,&char&c)&:height(ht),&width(wd),&contents(ht&*&wd,&c){}private: pos&height,&&//&不能在这儿初始化,初始化工作通常由构造函数来完成 std::string&};class&Window_mgr&{private: vector&Screen&&&//&不能在这儿初始化{&Screen(24,&80,&'&'&};};
c++11可以为数据成员提供一个类内初始值的,你指出的第一个错误编译没有任何问题的,我注释掉window_mgr类能正常编译的
提问者评价
其他类似问题
为您推荐:
其他2条回答
你这是哪本书, 这么高级的功能都拿出来了.首先查一下 VC2013支不支持这些特性.
C++primer第五版。。。
你会译码么,反过来译一遍
数据成员的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁1496人阅读
代码如下:&
C/C++ code
// Es1.7.cpp : 定义控制台应用程序的入口点。
//用指针来操作六个VECTOR的数列
#include "stdafx.h"
#include &iostream&
#include&vector&
using namespace
//遍历VECTOR,传递过来的是指向VECTOR的指针
void visit_vector( const vector&int& *&vector_pointer ){
for( int index = 0; index & (*vector_pointer).size(); index ++ ){
cout&&( *vector_pointer )[ index ]&&'/t';
int _tmain(int argc, _TCHAR* argv[])
const int seq_size = 8;
int fib[ seq_size ] = {
1, 1, 2, 3, 5, 8, 13, 21
int luc[ seq_size ] = {
1, 3, 4, 7, 11, 18, 29, 47
int pel[ seq_size ] = {
1, 2, 5, 12, 29, 70, 169, 408
int tri[ seq_size ] = {
1, 3, 6, 10, 15, 21, 28, 36
int squ[ seq_size ] = {
1, 4, 9, 16, 25, 36, 49, 64
int pen[ seq_size ] = {
1, 5, 12, 22, 35, 51, 70, 92
vector&int& fibonacci( fib, fib + seq_size ), lucas( luc, luc + seq_size ), pell( pel, pel + seq_size ), triangular( tri, tri + seq_size ), square( squ, squ + seq_size ), pentagonal( pen, pen + seq_size );
const int seq_cnt = 6;
vector&int& *seq_addres[ seq_cnt ] = {
&fibonacci, &lucas, &pell,
&triangular, &square, &pentagonal
for( int index = 0; index & seq_ index ++ ){
visit_vector( seq_addres[ index ] );
报错如下:&1&------ 已启动生成: 项目: Es1.7, 配置: Debug Win32 ------&1&正在编译...&1&Es1.7.cpp&1&d:/windc++_source_primer+essential/es1.7/es1.7/es1.7.cpp(12) : warning C4018: & &&: 有符号/无符号不匹配&1&d:/windc++_source_primer+essential/es1.7/es1.7/es1.7.cpp(48) : error C2664: &visit_vector&: 不能将参数 1 从&std::vector &_Ty& *&转换为&const std::vector &_Ty& *&&&1&& & & & with&1&& & & & [&1&& & & & & & _Ty=int&1&& & & & ]&1&& & & & 转换丢失限定符&1&生成日志保存在&file://d:/windC++_source_primer+Essential/Es1.7/Es1.7/Debug/BuildLog.htm&&1&Es1.7 - 1 个错误,1 个警告&========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========&
最后发现原因是这样子的:
不是说如果形参是CONST的实参可以是非CONST的吗?&上面这句话是针对非引用形参来说的。当形参是引用类型的&话,实参必须完全匹配形参类型。
其实问题很简单,涉及到引用符到底引用了什么的问题,看个简单的实例以解疑惑!
void test(const char* &x) //变量x引用的型别为const char*
int main()
const char*
test(ch); //ch的型别为const char*,当然没有问题
test(p); //p的型别为char*,问题来了,提示少了限定符
因此可简单的看做引用是对整体型别来说的,少一个字都say no了&
版权声明:本文为博主原创文章,未经博主允许不得转载。
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:152455次
积分:2732
积分:2732
排名:第6679名
原创:110篇
转载:38篇
评论:58条
(1)(1)(1)(1)(1)(1)(3)(4)(3)(4)(9)(5)(5)(15)(3)(13)(11)(6)(8)(9)(16)(6)(6)(8)(5)(3)}

我要回帖

更多关于 jq ajax error参数 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信