我试图建立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)。但这没有答案。看来作者不再维护这个项目了。所以我实际上需要您的帮助。非常感谢您,我的英语不好。

最佳答案

这是原始Github存储库的副本,其中包括允许编译现代copiler的修改。

https://github.com/LBrunswic/Seshat

关于c++ - SESHAT中对“元组”的引用含糊不清,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51251117/

10-11 19:02