我正在使用 gcc 6.2(带有 -std=c++14)。我有一个针对 Boost 1.62 构建的大项目,没有问题。当我切换到 Boost 1.64 时,出现此错误:
.../include/boost/property_map/property_map.hpp:133:11: error: ‘template<long unsigned int Idx, class T, long unsigned int N> con
st T& std::get(const boost::array<T, N>&)’ conflicts with a previous declaration
using ::get;
^~~
...include//boost/array.hpp:429:13: note: previous declaration ‘template<long unsigned int Idx, class T, long unsigned int N> con
st T& boost::get(const boost::array<T, N>&)’
const T &get(const boost::array<T,N> &arr) BOOST_NOEXCEPT {
^~~
不幸的是,我无法通过一个简单的示例重现该问题(不确定可能是什么问题,我制作了一个空的 main(),其中包括 property_map.hpp
和 array。 hpp
构建良好),所以我正在寻找正确方向的插入 :)。
最佳答案
确保查找导入单个函数的语句:
using std::get;
而不是仅仅导入包含 get() 的整个命名空间:
using namespace std;
关于c++ - std::get 在切换到 Boost 1.64 时发生冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46005510/