cmath header confusion

前端 未结 4 1820
深忆病人
深忆病人 2020-12-11 21:00

What is the namespace for math functions? Global or std?

Consider cos function. It has 3 overloads. But there is also legacy cos from math.

4条回答
  •  眼角桃花
    2020-12-11 21:22

    They are in the std namespace. But, for backwards compatibility reasons the cmath header also shows them in the global namespace with a using std::cos;.

提交回复
热议问题