c++ - 为什么 g++ 声明某些 valarray<double> o 有 "no matching function for call cbegin(o)"?

标签 c++ g++ c++14

请考虑以下代码:

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/

相关文章:

c++ - ZeroMQ:带有大消息的 REQ/REP

C++11 std::regex_match 返回额外字符

c++ - 为什么 "case::LABEL:"在 g++ 中编译?

c++ - std::array<const T, n> 与 std::array<T, n> 重载解析

c++ - 使用 boost::spirit::x3 编译错误

c++ - 从包含 m 行的文件中取出 n 行,必要时重复该文件(懒惰地)

c++ - 重复 Rcpp NumericVector

macos - 升级到 lion/new xcode 后无法使用 g++

c++ - 在编译时替换目标文件中的符号。例如换出 main

c++ - 这个失败的测试是否将零添加到空指针未定义的行为、编译器错误或其他什么?