Using STL/Boost to initialize a hard-coded setlt;vectorlt;intgt; gt;(使用 STL/Boost 来初始化一个硬编码集合lt;vectorlt;intgt;gt;)
问题描述
像这样 问题 已经问过了,我想使用 STL 初始化一个容器,其中元素以最干净的方式进行硬编码.在这种情况下,元素是一个双重嵌套的容器:
Like this question already asked, I'd like to initialize a container using STL where the elements are hard-coded in the cleanest manner possible. In this case, the elements are a doubly nested container:
我想(例如)将以下值放入:
And I'd like (for example) to put the following values in:
C++0x 很好,使用 g++
4.4.1.STL 更可取,因为我不将 Boost 用于代码的任何其他部分(尽管我不介意使用它的示例!).
C++0x fine, using g++
4.4.1. STL is preferable as I don't use Boost for any other parts of the code (though I wouldn't mind an example with it!).
推荐答案
这确实使用g++ 4.4.1, with -std=c++0x
This does use g++ 4.4.1, with -std=c++0x
这篇关于使用 STL/Boost 来初始化一个硬编码集合<vector<int>>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!