我正在尝试使用Windows 7上的C++17 gcd
和g++-5.1.0 (2015)
编译此示例Boost-1.71.0
代码。
#include <numeric>
int main() {
int x=90;
int y=9;
return gcd(x,y);
}
[当我使用:编译时
g++ gcd.cpp -IC:\Programs\boost-1.71.0\include -std=c++17
它说error: 'gcd' was not declared in this scope
如果这次是#include <boost/ratio/detail/mpl/gcd.hpp>
,它表示error: missing template arguments before '(' token
是指gcd的(
如何使g++-5.1.0
正确处理C++17
代码?谢谢。
[::mpl::gcd(x,y)
在C ++ 17中什么都没有。
我怀疑您的意思是std::gcd
。
[此外,实现std::gcd
(C ++ 17功能)的gcc-5.1(于2015年4月发布)的几率很低。它可以在此处实现-但这不是肯定的事情。
我无法让它与:: mpl一起运行,因为它似乎是比率的辅助结构。另一方面,您的意思是:
boost :: math :: gcd(x,y);