14-04.cpp

来自「more efftive 代码」· C++ 代码 · 共 28 行

CPP
28
字号
#include <iostream>#include <iterator>#include <algorithm>#include <functional>#include <memory>#include <cstdlib>using namespace std;class Int {public:  Int(int x) : val(x) {}	// Int ぃㄣΤ default constructor  int get() { return val; }private:  int val;};int main(){  int A1[] = {1, 2, 3, 4, 5, 6, 7};  const int N = sizeof(A1) / sizeof(int);    Int* A2 = (Int*) malloc(N * sizeof(Int));  transform(A1, A1 + N,            raw_storage_iterator<Int*, int>(A2),            negate<int>());}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?