Why std::sort doesn't accept Compare classes declared within a function

后端 未结 2 1941
醉酒成梦
醉酒成梦 2021-01-05 18:30

I was at work, writing the Comparators in a function (to move later, when I decided where was best), and noticed this peculiarity. I thought about it for a while, and reali

2条回答
  •  一生所求
    2021-01-05 19:17

    Your code is fine in C++11; there was a restriction about using local types as template arguments in C++03.

提交回复
热议问题