SESHAT中对“元组”的引用含糊不清

时间:2018-07-09 17:33:39

标签: c++ boost-tuples

我尝试构建SESHAT(手写数学表达式解析器)。而且我在下面遇到了这样的错误:

In file included from rnnlib4seshat/DataSequence.hpp:26:0,
             from symrec.h:30,
             from production.h:28,
             from hypothesis.h:30,
             from cellcyk.h:24,
             from tablecyk.h:26,
             from sample.h:27,
             from symfeatures.h:32,
             from symfeatures.cc:18:
rnnlib4seshat/Helpers.hpp:131:15: error: reference to ‘tuple’ is ambiguous
typedef const tuple<real_t&, real_t&, real_t&, real_t&>& TDDDD;
           ^~~~~

我在C编程方面没有太多经验。请帮助我解决此问题。

更新:这是Helpers.hpp文件的一部分

#ifndef _INCLUDED_Helpers_h  
#define _INCLUDED_Helpers_h  

#include <boost/date_time.hpp>
#include <boost/date_time/local_time/local_time.hpp>
#include <boost/assign/std/vector.hpp>
#include <boost/iterator/zip_iterator.hpp>
#include <boost/foreach.hpp>
#include <boost/math/distributions.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/range/irange.hpp>
#include <math.h>
#include <numeric>
#include <utility>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <sstream>
#include <list>
#include <set>
#include <algorithm>
#include <iterator>
#include <map>
#include <assert.h>
#include "Log.hpp"

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

#define LOOP BOOST_FOREACH
#define LOOP_BACK BOOST_REVERSE_FOREACH
#define DO(x, y) BOOST_FOREACH(BOOST_TYPEOF(*((y).begin()))& (x), (y))
#define DOC(x, y) BOOST_FOREACH(const BOOST_TYPEOF(*((y).begin()))& (x), (y))
#define OD(x, y) BOOST_REVERSE_FOREACH(BOOST_TYPEOF(*((y).begin()))& (x), (y))
#define COD(x, y) BOOST_REVERSE_FOREACH(const BOOST_TYPEOF(*((y).begin()))& (x), (y))
#define REPEAT(n) for(int REPEAT_VARn = 0; REPEAT_VARn < (n); ++REPEAT_VARn)
#define FROM(i, m, n) for(int (i) = (m); (i) < (n); ++(i))
#define MORF(i, m, n) for(int (i) = (n)-1; (i) >= (m); --(i))
#define FOR(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define ROF(i, n) for(int (i) = (n)-1; (i) >= 0; --(i))

//#define FLOAT_REALS

#ifdef FLOAT_REALS
typedef float real_t;
#else 
typedef double real_t;
#endif

....
line 131 begin here
typedef const tuple<real_t&, real_t&, real_t&, real_t&>& TDDDD;
typedef const tuple<real_t&, real_t&, real_t&, real_t&, real_t&>& TDDDDD;
typedef const tuple<real_t&, real_t&, real_t&>& TDDD;
typedef const tuple<real_t&, real_t&, int&>& TDDI;
typedef const tuple<real_t&, real_t&, real_t&>& TDDF;
typedef const tuple<real_t&, real_t&, real_t>& TDDCF;
typedef const tuple<real_t&, real_t&>& TDD;
typedef const tuple<int, string>& TIS;
typedef const tuple<int, int>& TII;
typedef const tuple<int, real_t>& TID;
typedef const tuple<int, set<int>&>& TISETI;
typedef const tuple<int&, bool, int>& TIBI;
typedef const tuple<real_t, Log<real_t>& >& TDL;
typedef const tuple<real_t&, Log<real_t>, Log<real_t> >& TDLL;
typedef Log<real_t> prob_t;

//global variables
....

我发现类似的问题已提交到该项目的“问题”标签(https://github.com/falvaro/seshat/issues/16)。但这没有答案。看来作者不再维护这个项目了。所以我实际上需要您的帮助。非常感谢您,我的英语不好。

1 个答案:

答案 0 :(得分:1)

这里是原始Github存储库的副本,包括修改后允许编译现代复印机。

https://github.com/LBrunswic/Seshat