发癫(2024.10.14-2024.10.18)

虽然已临近CSP复赛,但我还在不务正业

更改缺省源

最近几天莫名其妙的的想改一下我的缺省源。

之前和现在的缺省源比较:

之前:

#include<stdio.h>
#include<string.h>
//#include<bits/stdc++.h>
//#include<iostream>
//using namespace std;
//using std::cin;
#define itn int
#define ll long long
//#define int ll
int max(int x,int y){return x>y?x:y;}
int min(int x,int y){return x<y?x:y;}

const int MAX_add=10;
const int MAX_N=1000;
const int MAX_M=1000;
const int N=MAX_N+MAX_add;
const int M=MAX_M+MAX_add;

现在... :

#include<stdio.h>
#include<ctype.h>
//#include<bits/stdc++.h>//不耐烦了 
//#include<iostream>
//using namespace std;

#ifdef _GLIBCXX_IOSTREAM
#define endl '\n'
using std::cin;
using std::cout;
#define Fast_IO ios::sync_with_stdio(0),cin.tie(0)
#endif

namespace OI{//好长的缺省源 

#define ct const
#define ctr constexpr
#define itn int //防手残
#define un unsigned
typedef long long ll;
typedef unsigned long long ull;
typedef const int CI;
#define rt register
#define _rep(i,st,n) for(rt int i=(st);i<(n);++i)
#define rep(i,st,n) for(rt int i=(st);i<=(n);++i)
#define _dwh(i,st,n) for(rt int i=(st);i>(n);--i)
#define dwh(i,st,n) for(rt int i=(st);i>=(n);--i)
#define dw(n) while(n--)

const int L=1<<15;
char buf[L],*p1,*p2;
int my_getchar(){return (p1==p2?(p2=buf+fread(p1=buf,1,L,stdin),p1==p2?EOF:*p1++):*p1++);}
#define getchar my_getchar

int read()
{
	int x=0;
	bool f=0;
	char ch=getchar();
	while(!isdigit(ch)){if(ch=='-') f=!f;ch=getchar();}
	while(isdigit(ch)) x=x*10+(ch&15),ch=getchar();
	if(f) return -x;
	return x;
}

//#define int ll

int max(int x,int y){return x>y?x:y;}
int min(int x,int y){return x<y?x:y;}
int bmax(int &x,int y){return x=max(x,y);}
int bmin(int &x,int y){return x=min(x,y);}


template<class T,class U>
struct __is_same{static const int value=false;};
template<class T>
struct __is_same<T,T>{static const int value=true;};
#define is_same(T,U) (OI::__is_same<T,U>::value)

// C++ 11
template<class T>
T go_sum(T x){return x;}
template<class T,class ...Args>
T go_sum(T x,Args... args){return x+go_sum(args...);}

CI \
 MAX_add=10,
 MAX_N=1e7,
 MAX_M=2e5,
 N=MAX_N+MAX_add,
 M=MAX_M+MAX_add;

};

注:此次发癫2024.10.14左右至2024.10.16

《存储变量类型的类》

rt,又是一次莫名其妙,想造的

然后,不出意外的,出了意外。

附最后的代码:

//已省略缺省源
template<class T=int>
struct VAR{
	int use;
	VAR(){use=0;}
	
	template<class U>
	bool operator ==(VAR<U> y){return is_same(T,U);}
	template<class U>
	bool operator !=(VAR<U> y){return!is_same(T,U);}
};
const VAR<int> _INT;
const VAR<long> _LONG;
const VAR<short> _SHORT;
const VAR<double> _DOUBLE;

template<class T=int/*,class U=int*/>
struct _VAR{
	void *p;
	_VAR(){p=new VAR<T>;((VAR<T>*)p)->use=1;}
	template <class _T>
	_VAR operator =(_VAR<_T> a){
		p=a.p;
		((VAR<_T>*)p)->use++;
		return *this;
	}
	template <class _T>
	bool operator ==(_VAR<_T> a){
		return (*(VAR<>*)a.p)==(*(VAR<>*)p);
	}
	
	~_VAR()
	{
		((VAR<>*)p)->use--;
		if(((VAR<>*)p)->use==0) delete (VAR<>*)p;
	}
};
//#define 


_VAR<int> a,c;
_VAR<double> b;
int main()
{
	a=b;
	if(a==c) printf("TRUE");
	else printf("FALSE");
	return 0;
}

这个东东给我到此为止!!!

当然你有改进建议的话,就更好了

posted @ 2024-10-18 20:59  AC-13-13  阅读(0)  评论(0编辑  收藏  举报