#include <iostream>
#include <utility>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <random>
#include <fstream>
using namespace std;
template<typename T>
void init(T &t) {
t = T{};
}
#define def(type, name) \
type name; \
init(name);
// 用于内置非类类型
template<typename T, enable_if_t<!is_class_v<T>> * = nullptr>
struct Def {
using type = decay_t<T>;
type i;
Def() : i{} {}
Def(const type &other) : i(other) {};
Def &operator+=(const Def &other) {
i += other.i;
return *this;
}
Def &operator-=(const Def &other) {
i -= other.i;
return *this;
}
Def &operator*=(const Def &other) {
i *= other.i;
return *this;
}
Def &operator/=(const Def &other) {
i /= other.i;
return *this;
}
operator type() {
return i;
}
};
using Int = Def<int>;
using Double = Def<double>;
using Long = Def<long>;
using Short = Def<short>;
int main() {
// 定义并初始化
def (int, i);
def (int, j);
def(double, b);
cout << i << j << b << endl;
// 定义并初始化
Int ii;
Double di;
Short si;
cout << ii << "\t" << "\t" << si + 1 << endl;
di = 10;
di *= 10;
cout << di << endl;
}
10-11
592
11-25