Rnnlib安装范围错误

Rnnlib installation range error

我正在通过 https://github.com/meierue/RNNLIB

安装 rnnlib

安装 boost 和其他并完成其他步骤后,我收到错误 - SeqBuffer.hpp:227: error: reference to ‘range’ is ambiguous Helpers.hpp:298: error: candidates are: template<class T> std::pair<boost::iterators::counting_iterator<Incrementable, boost::iterators::use_default, boost::iterators::use_default>, boost::iterators::counting_iterator<Incrementable, boost::iterators::use_default, boost::iterators::use_default> > range(const T&, const T&)

Makefile:223: recipe for target 'DataExporter.o' failed
make[2]: *** [DataExporter.o] Error 1
make[2]: Leaving directory '/home/adminhp/Himaanshu/RNNLIB-master/src'
Makefile:217: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/adminhp/Himaanshu/RNNLIB-master'
Makefile:155: recipe for target 'all' failed
make: *** [all] Error 2

using namespace 再次出击。

Helpers.hpp 包含以下该死的序列:

using namespace std;
using namespace boost;
using namespace boost::assign;
using namespace boost::posix_time;
using namespace boost::gregorian;

坦率地说,在这一点上我会放弃。尤其是前两行在道德上相当于地毯式轰炸。使用凝固汽油弹。¹

更新 已创建 a pull request with the changes required to make the code compile.

更复杂的是,RNNLIB 的 range 工具甚至不在命名空间中...

因此,结果是 range 与来自 boost 的命名空间发生冲突。

消除冲突的最简单方法是将 range 的所有循环使用限定为 ::range...

PS. same comes up with equal later on


¹ Why is "using namespace std" considered bad practice?