c++ - 对 ‘tuple’ 的引用在 SESHAT 中不明确

标签 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)。但对此没有答案。看来作者不再维护这个项目了。所以我真的需要你的帮助。非常感谢,抱歉我的英语不好。

最佳答案

这是原始 Github 存储库的拷贝,包括允许编译现代编译器的修改。

https://github.com/LBrunswic/Seshat

关于c++ - 对 ‘tuple’ 的引用在 SESHAT 中不明确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51251117/

相关文章:

c++ - boost 记录器,多个日志文件和记录器

c++ - 提升元组 : increasing maximum number of elements

c++ - 引用 boost.fusion vector 中的元素

c++ - 为什么不能用兼容类型的 std::tuple 按元素构造 std::tuple?

c++ - 使用 IEEE FP 进行整数到浮点转换

c++ - 如何使用 MySQL Connector C++ 与数据库建立连接?

c++ - g++坏了?无法向类添加新方法

c++ - 模板代码返回类型重载未编译。怎么了

c++ - 模板函数错误(使用 Boost.Tuples)

c++ - 在 boost 元组 vector 中查找元素的位置