How do I define friends in global namespace within another C++ namespace?

后端 未结 4 1563
抹茶落季
抹茶落季 2021-01-01 19:08

I\'d like to define a binary operator on in the global namespace. The operator works on a class that is defined in another namespace and the operator should get access to th

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-01 19:33

    I don't know exact answer to your question.

    But it's terrible bad idea to define operator outside namespace of its parameters (now you cut argument dependent lookup which is very usable for operators).

提交回复
热议问题