【发布时间】:2012-02-23 07:12:50
【问题描述】:
我在 numeric 标头中找到了 STL 的 power,它在 O(log(a)) 中计算 power(TYPE T, Integer a),但是当我编写它并使用 g++ 编译它时,它给了我编译错误并说error: ‘power’ was not declared in this scope。为什么会发生?我知道编写以 O(log(N)) 计算的幂函数很容易买到我想知道 C++ 的标准库中是否有现成的函数。 C++11标准中没有增加任何特性吗?
【问题讨论】:
-
也许你想使用 std::pow,它是 C++ 的一部分。
标签: c++ algorithm stl c++11 numeric