小编lym*_*yml的帖子

为什么不在gcc的模板函数中使用boost :: tuple的.get工作?

在尝试移植一些代码以在linux中编译时,我得到了特殊的编译错误.通过代码库搜索,我终于设法将其归结为以下代码.

 5: // include and using statements
 6: template<typename RT, typename T1>
 7: RT func(tuple<T1> const& t) {
 8:     return t.get<0>();
 9: }
10: // test code
Run Code Online (Sandbox Code Playgroud)

试着用它我得到错误:

test.cpp: In function <functionName>:
test.cpp:8: error: expected primary-expression before ‘)’ token
Run Code Online (Sandbox Code Playgroud)

代码在Visual Studio中工作正常但由于某种原因我无法弄清楚为什么它不适用于g ++.这里的任何人都知道如何解决这个问题?

c++ templates boost tuples g++

8
推荐指数
1
解决办法
766
查看次数

标签 统计

boost ×1

c++ ×1

g++ ×1

templates ×1

tuples ×1