首页 > 其他分享 >求助,为什么过不了编译???

求助,为什么过不了编译???

时间:2023-02-07 21:44:38浏览次数:32  
标签:不了 iterator int 求助 pos 编译 operator using my

#include<bits/stdc++.h>
#include<bits/ptr_traits.h>
using namespace std;
int val;
struct my_iterator{
	using element_type = int;
	using value_type = int;
	using reference = int&;
	using pointer = int*;
	using difference_type = ptrdiff_t;
	using iterator_category = random_access_iterator_tag;
	int pos;
	my_iterator () = default;
	my_iterator (int pos_ ) : pos(pos_){}
	int& operator *(){
		return val;
	}
	friend bool operator  != (const my_iterator & a, const my_iterator& b){
		return a.pos != b.pos;
	}
	void operator ++(){
		++pos;
	}
	operator bool(){
		return pos != 0;
	}
};
template<typename T>
struct myallocator{
	using value_type = T;
	using pointer = my_iterator	;
	myallocator(){}
	template<typename U> myallocator(const myallocator<U>&&) {}
	pointer reallocate(size_t count){
		return my_iterator(0);
	}
	void deallocate(pointer p, size_t count){
		;
	}
};
int main(){
	vector<int, myallocator<int> > v;
}

标签:不了,iterator,int,求助,pos,编译,operator,using,my
From: https://www.cnblogs.com/cdsidi/p/17099906.html

相关文章

  • 华为交换机:配置IPSG防止主机私自更改IP地址示例(DHCP Snooping动态绑定),如果手动配置ip
    华为交换机:配置IPSG防止主机私自更改IP地址示例(DHCPSnooping动态绑定),如果手动配置ip就上不了网华为交换机:配置IPSG防止主机私自更改IP地址示例(DHCPSnooping动态绑定),如果手......
  • webrtc windows编译记录
    //cmdsetpath=D:\zzh\depot_tools;%path%setDEPOT_TOOLS_WIN_TOOLCHAIN0setvs2022_install=C:\ProgramFiles\MicrosoftVisualStudio\2022\Community//powershe......
  • 第一个编译器
    目录第一个编译器1.编译2.历史3.跳出某一种语言4.未来第一个编译器1.编译编译器也是也是一个运行程序,那么它是不是也需要另外一个编译器来编译呢?是的,那么第一个编......
  • 编译flannel 支持VNI 扩展
    实际上属于一个业务问题,有几个k8s环境,有一个外部服务需要通过rpc访问k8s内部的服务,以前是通过部署了与一个环境一样的flannel服务,可以保证外部服务与k8spod是可以......
  • 【C++复习】5.7 多文件结构与编译预处理命令
    1、C++项目结构C++程序的一般组织架构类声明文件(.h文件)类实现文件(.cpp文件)类的使用文件(main()所在的.cpp文件)用工程组合各文件2、编译链接编译链接过程3、外部......
  • 编译指令总结
    编译不过设置指令exportLC_ALL=C编译报错日志导出make-j82>&1|teebuild.log7.1编译指令sourcebuild/envsetup.shlunchmakeupdate-apimakesystemimage-j4......
  • mac m2编译 python3.7.6
    下载https://www.python.org/ftp/python/3.7.16/Python-3.7.16.tgz编译tar-zxvfPython-3.7.16.tgzcdPython-3.7.16.tgz./configure--prefix=/usr/local/python3.7......
  • 8.4仅靠编译是无法得到可执行文件的
    编译器转换源代码后,就会生成本地文件。不过,本地文件是无法直接运行的。编译器转换源代码后,就会生成本地文件。不过,本地文件是无法直接运行的。为了得到可以运行的EXE文件,......
  • 8.3编译器负责转换源代码
    能够把C语言等高级编程语言编写的源代码转换成本地代码的程序称为编译器。每个编写源代码的编程语言都需要其专用的编译器将C语言编写的源代码转换成本地代码的编译器称......
  • 8.3编译器负责转换源代码
    能够把C语言等高级编程语言编写的源代码转换成本地代码的程序称为编译器。每个编写源代码的编程语言都需要其专用的编译器。将C语言编写的源代码转换成本地代码的编译器称......