support bazel complie this project and format code.

This commit is contained in:
zhangxing
2023-03-30 00:15:11 +08:00
committed by light-city
parent 1f86192576
commit 7529ae3a55
636 changed files with 10025 additions and 9387 deletions

View File

@@ -8,38 +8,28 @@
#include <iostream>
#define isNs1 1
//#define isGlobal 2
// #define isGlobal 2
using namespace std;
void func()
{
cout<<"::func"<<endl;
}
void func() { cout << "::func" << endl; }
namespace ns1 {
void func()
{
cout<<"ns1::func"<<endl;
}
}
void func() { cout << "ns1::func" << endl; }
} // namespace ns1
namespace ns2 {
#ifdef isNs1
using ns1::func; /// ns1中的函数
#ifdef isNs1
using ns1::func; /// ns1中的函数
#elif isGlobal
using ::func; /// 全局中的函数
using ::func; /// 全局中的函数
#else
void func()
{
cout<<"other::func"<<endl;
}
void func() { cout << "other::func" << endl; }
#endif
}
} // namespace ns2
int main()
{
/**
* 这就是为什么在c++中使用了cmath而不是math.h头文件
*/
ns2::func(); // 会根据当前环境定义宏的不同来调用不同命名空间下的func()函数
return 0;
int main() {
/**
* 这就是为什么在c++中使用了cmath而不是math.h头文件
*/
ns2::func(); // 会根据当前环境定义宏的不同来调用不同命名空间下的func()函数
return 0;
}