簡體   English   中英

填充std :: deque <std::vector<std::string> &gt;使用boost :: assign :: list_of

[英]Populate std::deque<std::vector<std::string>> with boost::assign::list_of

是否可以初始化以下類型的對象:

std::deque<std::vector<std::string>>

通過boost :: assign :: list_of

請嘗試以下操作:

#include <boost/assign/list_of.hpp>
#include <deque>
#include <vector>
#include <iostream>
#include <string>

int main()
{
    std::deque<std::vector<std::string> > v =
        boost::assign::list_of
            (boost::assign::list_of("a")("b"))
            (boost::assign::list_of("c")("d"));

    std::cout << v[0][0] << "\n" <<
                 v[1][1] << "\n";
}

使用最舊的編譯器進行編譯,我可以使用VC7,而不能使用C ++ 98。

暫無
暫無

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

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