Stephan T. Lavavej: Core C++, 1 of n

Stephan T. Lavavej: Core C++, 1 of n

Update: 2012-05-16
Share

Description

In part 1, STL focuses on Name Lookup, which is a surprisingly complex process.

Remember Herb Sutter's great GotW post (#30, to be precise) on Name Lookup? Here's the problem from that post, to refresh your memory (Thanks to Herb for providing information like this on GotW!):

In the following code, which functions are called? Why? Analyze the implications?


namespace A {
struct X;
struct Y;
void f( int );
void g( X );
}

namespace B {
void f( int i ) {
f( i ); // which f()?
}
void g( A::X x ) {
g( x ); // which g()?
}
void h( A::Y y ) {
h( y ); // which h()?
}
}

We recommend you watch this entire episode before playing around with Herb's sample above (and don't read the GotW answer, either! That's cheating. Learn from STL. He's an outstanding teacher, as you know.)

Please supply feedback on this thread, especially as it relates to what you'd like STL to focus on in subsequent episodes. For part 2, STL will focus on Template Argument Deduction.

Tune in. Enjoy. Learn.

Comments 
loading
00:00
00:00
1.0x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

Stephan T. Lavavej: Core C++, 1 of n

Stephan T. Lavavej: Core C++, 1 of n

Charles