一个实用的头文件

#include<cgraph>

可是,好像没有这玩意啊?
·
·
·
·
自己写!

#ifndef _GRAPH_H_
#define _GRAPH_H_

#endif //_GRAPH_H_

好了,然后呢?

#include<graphics.h>
#include<bits/stdc++.h>

#include <boost/multiprecision/cpp_int.hpp>

using namespace boost::multiprecision;

功能到底都在那里?
别急。

#define __int0 		struct{}
#define __int256 	int256_t
#define __int512 	int512_t
#define __int1024	int1024_t
#define char32    	char32_t
#define char16		char16_t
#if (__cplusplus<=20110000L)
#undef char32
#undef char16
#endif

什莫意思?
__int0是空类型。
int256_t这些都在boost里的
char32_t是11新增的
可是,我的编译器是最新的,为什么编译说char32_t不是标识符呢?
加一句

-std=c++11

好了吧?
继续!

#ifdef __GNUC__
typedef bool __int1;
#ifdef __cplusplus
typedef __int0    int0   , *pint0;
typedef __int1	  int1   , *pint1;
typedef __int8	  int8   , *pint8;
typedef __int16	  int16  , *pint16;
typedef __int32   int32  , *pint32;
typedef __int64   int64  , *pint64;
#ifdef _WIN64
typedef __int128  int128 , *pint128;
typedef __int256  int256 , *pint256;
typedef __int512  int512 , *pint512;
typedef __int1024 int1024, *pint1024;
#endif
#endif //__cplusplus
#endif //__GNUC__ 

__int8 ? __int16 ? __int32 ? __int64 ? __int128 ?
__ GNUC __?
先来看看<_mingw.h>里说的吧。

#ifdef __GNUC__
#define __int8 char
#define __int16 short
#define __int32 int
#define __int64 long long
#ifdef _WIN64
#if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1)) && \
    !defined(__SIZEOF_INT128__) /* clang >= 3.1 has __int128 but no size macro */
#define __SIZEOF_INT128__ 16
#endif
#ifndef __SIZEOF_INT128__
typedef int __int128 __attribute__ ((__mode__ (TI)));
#endif
#endif
#endif /* __GNUC__ */

只有在__GNUC__的时候才有__int8等等。
WIN64是指 你的电脑是WIN64。
__ attribute __ (( __ mode
_ (TI)))
TI是指128位。
好,下一步

using namespace std;
#ifdef nomain
int EGEAPI egeMain();
int main(){
	return egeMain();
}
#endif //main

如果这样使用:

#define nomain
#include<cgraph>

那么就需要:

int EGEAPI egemain(){
	//...
}

如果再加些功能,你可以把它汇编成库。

发布了3 篇原创文章 · 获赞 0 · 访问量 97

猜你喜欢

转载自blog.csdn.net/PIPE111/article/details/104382910