-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathArgumentDependentNameLookup.cpp
More file actions
59 lines (47 loc) · 1.47 KB
/
ArgumentDependentNameLookup.cpp
File metadata and controls
59 lines (47 loc) · 1.47 KB
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
55
56
57
58
59
// =====================================================================================
// ArgumentDependentNameLookup.cpp
// =====================================================================================
module modern_cpp:argument_dependent_name_lookup;
namespace ArgumentDependentNameLookup
{
namespace MyNamespace
{
class MyClass {};
static void doSomething(MyClass) {}
static void doSomething() {}
}
namespace MyProject
{
static void test_01()
{
MyNamespace::MyClass obj;
// doSomething(); // Error: 'doSomething': identifier not found
MyNamespace::doSomething(); // works
doSomething(obj); // works too
}
static void test_02()
{
std::cout << "Hello World" << std::endl;
}
static void test_03()
{
using std::operator<<;
std::cout << "Hello World" << std::endl;
}
static void test_04()
{
std::operator<<(std::cout, "Hello World").operator<<(std::endl);
}
}
}
void main_argument_dependent_name_lookup()
{
using namespace ArgumentDependentNameLookup::MyProject;
test_01();
test_02();
test_03();
test_04();
}
// =====================================================================================
// End-of-File
// =====================================================================================