• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <functional>
11 
12 // reference_wrapper
13 
14 // operator T& () const;
15 
16 #include <functional>
17 #include <cassert>
18 
19 class functor1
20 {
21 };
22 
23 template <class T>
24 void
test(T & t)25 test(T& t)
26 {
27     std::reference_wrapper<T> r(t);
28     T& r2 = r;
29     assert(&r2 == &t);
30 }
31 
f()32 void f() {}
33 
main()34 int main()
35 {
36     void (*fp)() = f;
37     test(fp);
38     test(f);
39     functor1 f1;
40     test(f1);
41     int i = 0;
42     test(i);
43     const int j = 0;
44     test(j);
45 }
46