eb59.c

来自「linux下编程用 编译软件」· C语言 代码 · 共 32 行

C
32
字号
// { dg-do run  }#define INC_FUNCTIONAL  1#define USE_STATIC_CAST 1#include <vector>#include <numeric>#ifdef INC_FUNCTIONAL#include <functional>#endifusing namespace std;template<class R> int p( int val, R& r ){   return val + r;}template<class R> void f( vector<R>& v ){#ifdef USE_STATIC_CAST   accumulate( v.begin(), v.end(), 0, static_cast<int (*)(int, R&)>(p) );#else   accumulate( v.begin(), v.end(), 0, p<R> );#endif}int main(){   vector<int> r;   f( r );}

⌨️ 快捷键说明

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