请考虑以下代码:
using custom_t = std::valarray<unsigned>;
custom_t o;
unsigned acc = std::accumulate(std::cbegin(o), std::cend(o), 0);
g++-5 说
No matching function for call to
cbegin(custom_t&)
如果我改用 std::begin(o)
和 std::end(o)
,一切正常。这是编译器错误吗?代码使用 Visual Studio 2015 编译。
最佳答案
这是一个 libstdc++ 错误,我刚刚创建了 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67374
关于c++ - 为什么 g++ 声明某些 valarray<double> o 有 "no matching function for call cbegin(o)"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32255326/