]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/function_objects/binders/1.cc
1 // Copyright (C) 2005-2020 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
27 void f_void_int_const(int) const {}
28 void f_void_int(int) {}
29 int f_int_int_const(int) const { return 1; }
30 int f_int_int(int) {return 1; }
31 void f_void_void_const() const {}
33 int f_int_void_const() const { return 1; }
34 int f_int_void() { return 1; }
39 mem_fun_t
<void, s
> p1(&s::f_void_void
);
40 mem_fun_t
<int, s
> p2(&s::f_int_void
);
43 mem_fun1_t
<void, s
, int> q1(&s::f_void_int
);
44 mem_fun1_t
<int, s
, int> q2(&s::f_int_int
);
48 (mem_fun(&s::f_void_void
))(&a
);
49 (mem_fun(&s::f_void_int
))(&a
,0);
50 (mem_fun(&s::f_int_void
))(&a
);
51 (mem_fun(&s::f_int_int
))(&a
,0);
53 mem_fun_ref_t
<void, s
> ref1(&s::f_void_void
);
54 mem_fun_ref_t
<int, s
> ref2(&s::f_int_void
);
59 mem_fun1_ref_t
<void, s
, int> ref3(&s::f_void_int
);
60 mem_fun1_ref_t
<int, s
, int> ref4(&s::f_int_int
);
65 (mem_fun_ref(&s::f_void_void
))(a
);
66 (mem_fun_ref(&s::f_void_int
))(a
, 0);
67 (mem_fun_ref(&s::f_int_void
))(a
);
68 (mem_fun_ref(&s::f_int_int
))(a
, 0);
71 void test02(const s
& a
)
73 const_mem_fun_t
<void, s
> p1(&s::f_void_void_const
);
74 const_mem_fun_t
<int, s
> p2(&s::f_int_void_const
);
77 const_mem_fun1_t
<void, s
, int> q1(&s::f_void_int_const
);
78 const_mem_fun1_t
<int, s
, int> q2(&s::f_int_int_const
);
82 (mem_fun(&s::f_void_void_const
))(&a
);
83 (mem_fun(&s::f_void_int_const
))(&a
, 0);
84 (mem_fun(&s::f_int_void_const
))(&a
);
85 (mem_fun(&s::f_int_int_const
))(&a
, 0);
87 const_mem_fun_ref_t
<void, s
> ref1(&s::f_void_void_const
);
88 const_mem_fun_ref_t
<int, s
> ref2(&s::f_int_void_const
);
93 const_mem_fun1_ref_t
<void, s
, int> ref3(&s::f_void_int_const
);
94 const_mem_fun1_ref_t
<int, s
, int> ref4(&s::f_int_int_const
);
99 (mem_fun_ref(&s::f_void_void_const
))(a
);
100 (mem_fun_ref(&s::f_void_int_const
))(a
, 0);
101 (mem_fun_ref(&s::f_int_void_const
))(a
);
102 (mem_fun_ref(&s::f_int_int_const
))(a
, 0);