My std

Posted zhang-sheng-hao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了My std相关的知识,希望对你有一定的参考价值。

update on 2020 02 14

code
#include<bits/stdc++.h>
namespace IO
{
	using namespace std;
	char buf[1<<22],Out[1<<22],*p1=buf,*p2=buf;
	int p3=-1,f=0;
	inline void file()
	{
		#ifdef NTFOrz
		freopen("file.in","r",stdin);
		#endif
	}
	inline char getchar()
	{
		return (p1==p2)&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;
	}
	inline void flush(){fwrite(Out,1,p3+1,stdout),p3=-1;}
	inline void check(){if (p3>(1<<21)) flush();}
	inline void putchar(char a){Out[++p3]=a;check();}
	inline void putline(string s)
	{
		int tmp=p3;
		while (p3-tmp<s.size()) putchar(s[p3-tmp]);
		putchar(‘
‘);
	}
}
namespace my_std
{
    using namespace std;
    #define getchar IO::getchar
    #define putchar IO::putchar
    #define Re register
    #define rep(i,a,b) for (Re int i=(a);i<=(b);i++)
    #define drep(i,a,b) for (Re int i=(a);i>=(b);i--)
    #define repv(i,v) if (v.size()) rep(i,0,v.size()-1)
    #define drepv(i,v) if (v.size()) drep(i,v.size()-1,0)
    #define go(u) for (Re int i=head[(u)];i;i=e[i].nxt)
    #define pf printf
    #define writesp(x) write(x),putchar(‘ ‘),IO::check()
    #define writeln(x) write(x),putchar(‘
‘),IO::check()
    #define mem(x,v) memset(x,v,sizeof(x))
    #define pb push_back
    #define NTF return
    #define AKIOI 0
    typedef long long ll;
    const int INF=0x7fffffff;
    inline int read()
    {
        int sum=0,f=0;
        char c=getchar();
        while (!isdigit(c))
        {
            f|=(c==‘-‘);
            c=getchar();
        }
        while (isdigit(c))
        {
            sum=(sum<<1)+(sum<<3)+(c^48);
            c=getchar();
        }
        return f?-sum:sum;
    }
    void write(int k)
    {
        if (k<0) putchar(‘-‘),k=-k;
        if (k>=10) write(k/10);
        putchar(k%10+48);
    }
    #define templ template<typename T>
    templ inline void chkmax(T &x,T y){if (x<y) x=y;}
    templ inline void chkmin(T &x,T y){if (x>y) x=y;}
}
using namespace my_std;

update on 2020 06 26

code
#include<bits/stdc++.h>
#define Re register
#define rep(i,a,b) for (Re int i=(a);i<=(b);i++)
#define drep(i,a,b) for (Re int i=(a);i>=(b);i--)
using namespace std;
typedef long long ll;
inline void setfile()
{
	#ifdef stO_PBNTF_Orz
	freopen("file.in","r",stdin);
	#endif
}
struct istream
{
	char buf[1<<22],*p1=buf,*p2=buf;
	inline char getchar() {return (p1==p2)&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
	template <typename T> inline void read(T &x)
	{
		x=0;int f=0;char c=getchar();
		while (!isdigit(c)) f|=(c==‘-‘),c=getchar();
		while (isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
		x=f?-x:x;
	}
	inline bool useless(char c) {return !c||c==‘ ‘||c==‘
‘;}
	istream& operator >> (char &c) {while (useless(c)) c=getchar();return *this;}
	istream& operator >> (char *ch)
	{
		int cnt=-1;char c=getchar();
		while (useless(c)) c=getchar();
		while (!useless(c)) ch[++cnt]=c,c=getchar();
		return *this;
	}
	istream& operator >> (int &x) {read(x);return *this;}
	istream& operator >> (ll &x) {read(x);return *this;}
}in;
struct ostream
{
	char buf[1<<22],stk[1<<10];int p=-1;
	inline void flush() {fwrite(buf,1,p+1,stdout),p=-1;}
	~ostream() {flush();}
	inline void putchar(char c) {buf[++p]=c;}
	template <typename T> inline void write(T x)
	{
		static int top=0;
		if (x<0) putchar(‘-‘),x=-x;
		while (stk[++top]=x%10+‘0‘,x>=10) x/=10;
		while (top) putchar(stk[top--]);
		if (p>(1<<21)) flush();
	}
	ostream& operator << (char c) {putchar(c);return *this;}
	ostream& operator << (char *c) {rep(i,0,(int)(strlen(c))-1) putchar(c[i]);return *this;}
	ostream& operator << (string s) {rep(i,0,(int)(s.size())-1) putchar(s[i]);return *this;}
	ostream& operator << (int x) {write(x);return *this;}
	ostream& operator << (ll x) {write(x);return *this;}
}out;

未完待续

以上是关于My std的主要内容,如果未能解决你的问题,请参考以下文章

My std

包含std :: list的结构的c ++初始化[重复]

为什么std :: foreach不能用于std :: vector ? [重复]

vue中的组件

如何在初始化期间将 std::initializer_list 转换为列矩阵或列向量?

std::atoi() 和 std::stoi 有啥区别?