2013-10-18 138 views
0

我是noob,但我知道它不關心什麼是數據類型容器包含。 因此,這裏是我想要做的事:STL:容器的容器

std::deque<list<U32> >  ReqLis; 

和結果是下一:

error: ISO C++ forbids declaration of 'deque' with no type 
error: invalid use of '::' 
expected ';' before '<' token 

但當代替它,我嘗試這樣做:

std::list<list<U32> >  ReqList; 

沒關係..................

問題是我是如此偉大的noob還是編譯失敗? 我正在使用gcc/g ++

+7

做你的#include''? – billz

+1

你不應該使用'U32',但更好的'std :: uint32_t'。 – Walter

+0

std :: deque >? – zoska

回答

3

你能列出所有的代碼嗎?代碼中的命名空間的使用有點鬆散。

在一個單獨的標頭中的雙端隊列cpp reference

#include <deque> 
+0

完全忘了它:( – Douman

3

沒有名爲U32標準型,但如果你#包括(stdint.h爲C)可以使用std :: uint32_t1,一個32位無符號整數,這是(我假設)你想要的。

首先你應該包括用戶U32這個頭文件

#include <cstdint> 

    std::deque<std::list<std::uint32_t>> ReqList; 
2

添加以下內容:

#include <list> 
#include<deque> 
#include<stdint.h> 
    std::deque<uint32_t> ReqList; 



    #include<deque> is for deque data type 
    #include<list> is for list data type 
    #include<stdint.h> is for uint32_t (Integer type with a width of exactly 8, 16, 32, or 
        64 bits.For signed types, negative values are represented using 2's 
        complement.