-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest5.h
54 lines (43 loc) · 821 Bytes
/
test5.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once
namespace test5
{
class Bar
{
public:
Bar()
{
std::cout << "Bar()" << std::endl;
}
~Bar()
{}
Bar(Bar const&)
{
std::cout << "Bar(Bar const&)" << std::endl;
}
Bar(Bar&&) noexcept
{
std::cout << "Bar(Bar&&)" << std::endl;
}
void operator()() const
{
std::cout << "void operator()()" << std::endl;
}
};
// Если эту функцию закомментировать, то будет:
// No matching function for call to 'Foo'
void Foo(Bar const&)
{
std::cout << "void Foo(std::function<void()> const&)" << std::endl;
}
void Foo(Bar&&)
{
std::cout << "void Foo(std::function<void()>&&)" << std::endl;
}
void Run()
{
Bar b;
// Bar()
Foo(b);
// void Foo(std::function<void()> const&)
}
}