Functions with class arguments are leaked from a namespace?

前端 未结 4 1225
礼貌的吻别
礼貌的吻别 2021-02-02 11:14

I have a small piece of code here for your consideration which puzzles me quite a lot. The strange thing is that it compiles on both Sun Studio and GCC even though I think it sh

4条回答
  •  佛祖请我去吃肉
    2021-02-02 12:09

    It's called argument-dependent lookup (or Koenig lookup). In short, the compiler will look for the function in namespaces that are the namespaces of argument types.

提交回复
热议问题