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

#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;
}
posted @ 2023-02-07 21:34  CDsidi  阅读(23)  评论(0编辑  收藏  举报