/* ベクトル加算サンプル */ //#define DEBUG #ifdef DEBUG const bool debug = true; #else const bool debug = false; #endif #include "et1.h" /* 普通の足し算 */ //#include "et2.h" /* ETべたべた */ //#include "et3.h" /* ET template */ //#include "et4.h" /* ET template 一般化 */ using namespace std; int main() { Vect w; { Vect x, y, z; for (int i = 0; i < Vect::N; i++) { x[i] = i; y[i] = Vect::N - i; z[i] = i * 2; } if (debug) puts("--- here ---"); #if 0 cout << "x=" << x << endl; cout << "y=" << y << endl; cout << "z=" << z << endl; #endif w = x + y + z; // w = (x + y) + z; // w = x + (y + z); // w = x + (y + z) + x + y + z; } cout << "w=" << w << endl; return 0; }