OSDN Git Service

update
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.robertl / eb59.C
1 #define INC_FUNCTIONAL  1
2 #define USE_STATIC_CAST 1
3
4 #include <vector>
5 #include <numeric>
6 #ifdef INC_FUNCTIONAL
7 #include <functional>
8 #endif
9
10 template<class R> int p( int val, R& r )
11 {
12    return val + r;
13 }
14
15 template<class R> void f( vector<R>& v )
16 {
17 #ifdef USE_STATIC_CAST
18    accumulate( v.begin(), v.end(), 0, static_cast<int (*)(int, R&)>(p) );
19 #else
20    accumulate( v.begin(), v.end(), 0, p<R> );
21 #endif
22 }
23
24 main()
25 {
26    vector<int> r;
27    f( r );
28 }