title: What reason is there to not add nested class/struct resolution in C++ when performing method calls?
body: <p>Considering the following toy program:</p>
  <pre><code>struct Foo
  {
    struct Bar {};
  
    Foo(Bar b);
  
    Bar m_b;
  };
  
  Foo::
  Foo(Bar b) // Bar resolved properly
  : m_b(b)
  { }
  
  int main() {
  
      auto f = Foo( Bar() ); // Bar not resolved  
  
      return 0;
  }
  </code></pre>
  <p>Why do I need to explicitly type <code>Foo::Bar</code> when calling the <code>Foo</code>'s constructor? Is there a technical reason for this? Is there any way to resolve <code>Bar</code> without typing <code>Foo f(Foo::Bar b);</code>?</p>
  <p>Any argument can be made that if there is another <code>Bar</code> then it could get ambiguous. But we deal with those kind of ambiguities all the time (by manually resolving the symbol to remove ambiguity).</p>
  <hr />
  <p>From the comments it seems people are wondering why you would ever to do this. Well, languages like Objective-C have messages that have additional message names to help indicate the information that is being passed.</p>
  <p>I found this very helpful especially when reading code after it has been written. What I have above is a trivial program. But imagine if there was a class <code>Ray</code> which has an origin and direction. If we were to construct it like this <code>Ray r(Vec3(0, 1, 0), Vec3(1, 0, 0))</code>, which vector is the origin and which is the direction? The verbosity helps in this case. We can have strong typedefs for <code>Vec3</code> named <code>origin</code> and <code>direction</code>. This will allow us to do something like this <code>Ray r(origin(Vec3(0, 1, 0)), direction(Vec3(1, 0, 0))</code>.</p>
  <p>But of course, unlike objective-c, I have to resolve the names (be it a nested <code>struct/class</code> or <code>strong_typedef</code>) like this <code>Ray r(Ray::origin(Vec3(0, 1, 0)), Ray::direction(Vec3(1, 0, 0)))</code> which can become even more verbose with namespaces.
  <strong>/Edit</strong></p>
  <blockquote>
  <p>I guess this question is stemming from frustrating when working with libraries (including my own) where there is liberal use of <code>strong_typedef</code> or a nested <code>struct/class</code> inside another <code>class</code> (e.g. a parameters class) and I am forced to resolve the name fully.</p>
  <p>Of course, I would not opt to remove the <code>strong_typedef</code> as it definitely makes the code more readable.</p>
  </blockquote>