簡體   English   中英

C ++中元組的代碼塊錯誤

[英]Codeblock error for tuple in c++

我已經在代碼塊(C ++)中編寫了以下代碼:

#include <bits/stdc++.h>
using namespace std;
int main(void)
{
    vector<int> v;
    tuple<int,int,int> t1 = make_tuple(1,2,3)
    tuple<char,int,double,int,long long int >t2;
    t2=make_tuple( 'a' , 2 , 2.3 , 1 , 10000 );
    cout<< get<2>t1 << " "<< get<0> t2;// will print 3 and 'a'
}

當我提示編譯時,它顯示許多錯誤。 一個錯誤是:

 no match for 'operator<<' (operand types are 'std::ostream {aka std::basic_ostream<char>}' and '<unresolved overloaded function type>')|

誰能告訴我原因是什么? 我是否缺少任何庫文件?

get<x> y必須是get<x>(y)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM