push进队列的C2075错误
来源:互联网 发布:低空突防航迹规划算法 编辑:程序博客网 时间:2024/05/22 18:59
碰到了一个问题,记录下。
代码如下所示:
//source.h
#include <queue>
using namespace std;
typedef int ARR[500];
queue<ARR> arr;
//source.cpp
#include "source.h"
#include <iostream>
#include <iostream>
int main()
{
ARR _arr;
arr.push(_arr);
return 0;
}
{
ARR _arr;
arr.push(_arr);
return 0;
}
/***********************************************分割线***********************************************/
编译错误为:c:\program files (x86)\microsoft visual studio 9.0\vc\include\xmemory(52) : error C2075: 'Target of operator new()' : array initialization needs curly braces
查官方文档,错误可能产生的原因:
但这不是啊,后来问人,原来是个低级错误。typedef只能算别名,并没有产生任何新的数据结构,修改如下:
//source.h
#include <queue>
using namespace std;
struct ARR{
int arr[500];
};
int arr[500];
};
queue<ARR> arr;
//source.cpp
#include "source.h"
#include <iostream>
#include <iostream>
int main()
{
ARR _arr;
arr.push(_arr);
return 0;
}
{
ARR _arr;
arr.push(_arr);
return 0;
}
编译通过。。
阅读全文
0 0
- push进队列的C2075错误
- git删除错误的commit和push
- 两个栈实现队列的pop与push操作
- 菜鸟:模拟栈和队列的push和pop
- js队列方法push()、shift()与pop()、unshift()的理解
- 两个栈实现一个队列的push和pop
- 消息队列的pull与push模式理解
- 前端关于队列push(),shift()的操作(pop(),unshift())
- 用栈实现队列的push、top和pop
- 用两个栈来实现一个队列,完成队列的Push和Pop操作
- 用两个栈来实现一个队列,完成队列的Push和Pop操作
- 用两个栈来实现一个队列,完成队列的Push和Pop操作。
- 6.用两个栈来实现一个队列,完成队列的Push和Pop操作
- 用两个栈来实现一个队列,完成队列的Push和Pop操作。
- git push错误failed to push some refs to的解决
- github push 403 错误
- git push 错误总结
- ADB push 错误
- 经典排序算法和JS实现
- Java 递归结束
- 大数据学习笔记(六)-Spark环境配置
- 计算机网络——链路层和局域网
- 647. Palindromic Substrings
- push进队列的C2075错误
- 讯飞AIUI apiWeb java
- 关于@JsonFormat的使用
- 用PHP快速开发一个爬虫,用到的开源库
- powerdesigner comment 写到 name 和 name 写到 comment
- github命令大全
- 封装一个小JS模块
- rand和srand随机函数的用法
- 4用于cifar10的卷积神经网络-4.22为计算图中的非线性全连接层的权重添加L2损失