当前位置: 首页>>代码示例>>C++>>正文


C++ LIST::push_back方法代码示例

本文整理汇总了C++中LIST::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ LIST::push_back方法的具体用法?C++ LIST::push_back怎么用?C++ LIST::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LIST的用法示例。


在下文中一共展示了LIST::push_back方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main()
{
    LIST list;
    list.push_back(12);
    list.push_back(4);
    list.push_back(8);
    list.push_back(5);
    cout<<get_max(list)<<endl;
    int x = 120;
    int y = 121;
    cout<<get_max(x, y)<<endl;
    return 0;
}
开发者ID:liangcheng,项目名称:16_practice,代码行数:13,代码来源:test_functionOverloading.cpp

示例2: read_words

void read_words(const string filename) {
	assert(!open_word_list);

	ifstream fin(filename.c_str());
	assert(fin.is_open());

	_all_words.clear();

	word_list.clear();
	word_list.push_back("");
	assert(word_list.at(NO_WORD) == "");
	word_map.clear();
	word_map[""] = NO_WORD;		// FIXME: Don't use [] operator

	unsigned i;
	string word;
	while(!fin.eof()) {
		fin >> i >> ws >> word >> ws;

		word_list.push_back(word);
		assert(word_list.at(i) == word);
		word_map[word] = i;	// FIXME: Don't use [] operator
		_all_words.push_back(i);

//		if (word == "*content*") _Word_CONTENT = i;
	}
	assert(word_list.size() == word_map.size());

	cerr << "Read " << word_list.size()-1 << " words from '" << filename << "'\n";

	fin.close();
	open_word_list = true;
}
开发者ID:arne-cl,项目名称:turian-parser,代码行数:33,代码来源:vocabulary.C

示例3: read

bool read(LIST& v) {
    static int ch;
    if ((ch = getchar()) == EOF) {
        return false;
    }
    v.clear();
    while (ch != '\n') {
        ungetc(ch, stdin);
        scanf("%d", &ch);
        v.push_back(make_pair(ch, (int)v.size()));
        ch = getchar();
    }
    return true;
}
开发者ID:Crmiv,项目名称:AlgoSolution,代码行数:14,代码来源:3441.cpp

示例4: posclass_init

static void posclass_init() {
	assert(!posclass_is_init);

	posclass_map.clear();
	_all_posclass.clear();

	unsigned skipcnt = 0;
	for (unsigned i = 0; i < tag_to_class_cnt; i++) {
		// Skip labels not in the vocabulary.
		if (!is_label_string(tag_to_class[i][0])) {
			Debug::log(1) << "Skipping unknown label " << tag_to_class[i][0] << " in posclass_init()\n";
			skipcnt++;
			continue;
		}
		
		Label tag = string_to_label(tag_to_class[i][0]);
		assert(is_terminal_label(tag));

		Posclass c = string_to_posclass(tag_to_class[i][1]);
		assert(posclass_list[c] == tag_to_class[i][1]);
		assert(posclass_list[c] != "");

		posclass_map.insert(tag, c);
	}
	posclass_map.lock();

	for (unsigned i = 0; i < posclass_cnt; i++) {
		if (posclass_list[i] != "")
			_all_posclass.push_back(i);
		if (posclass_list[i] == "::N")
			_Posclass_N = i;
		else if (posclass_list[i] == "::NP")
			_Posclass_NP = i;
	}

	posclass_is_init = true;
}
开发者ID:arne-cl,项目名称:turian-parser,代码行数:37,代码来源:posclass.C

示例5: addRest

 void addRest(const Polynomial & p) {
   GBStream << "ADDING " << p << " for " << d_m << '\n';
   d_rest.push_back(p);
 };
开发者ID:lolmid,项目名称:2015-2016,代码行数:4,代码来源:TheRule.hpp

示例6: read_labels

/// \todo Make some assertion about # of constit. labels, and/or that
/// they are the lowest numbered ones?
void read_labels(const string filename) {
	assert(!open_label_list);

	ifstream fin(filename.c_str());
	assert(fin.is_open());

	_all_labels.clear();
	_all_constituent_labels.clear();
	_all_terminal_labels.clear();
	_max_label = 0;

	label_list.clear();
	label_map.clear();
	terminal_set.clear();
	constituent_set.clear();

	unsigned i, is_terminal, cnt;
	string label;
	while(!fin.eof()) {
		fin >> i >> ws >> is_terminal >> ws >> cnt >> label >> ws;

		if (i == NO_LABEL)
			label = "";

		label_list.push_back(label);
		assert(label_list.at(i) == label);
		label_map[label] = i;	// FIXME: Don't use [] operator

		if (i != NO_LABEL) {
			_all_labels.push_back(i);
			if (is_terminal) {
				terminal_set.insert(i, true);
				_all_terminal_labels.push_back(i);
			} else {
				constituent_set.insert(i, true);
				_all_constituent_labels.push_back(i);
			}
			if (i > _max_label) _max_label = i+1;
		}
	}
	assert(label_list.at(NO_LABEL) == "");
	assert(label_map[""] == NO_LABEL);	// FIXME: Don't use [] operator
	assert(label_list.size() == label_map.size());
//	assert(label_map.size() == terminal_set.size() + constituent_set.size() + 1);
	terminal_set.lock();
	constituent_set.lock();

/*
	Debug::log(1) << "Read " << constituent_set.size() << " constituents, " << \
			terminal_set.size() << " terminals from '" << filename << "'\n";
*/

	fin.close();
	open_label_list = true;

	if (is_label_string("ADJP")) _Label_ADJP = string_to_label("ADJP");
	if (is_label_string("ADVP")) _Label_ADVP = string_to_label("ADVP");
	if (is_label_string("AUX")) _Label_AUX = string_to_label("AUX");
	if (is_label_string("AUXG")) _Label_AUXG = string_to_label("AUXG");
	if (is_label_string("CC")) _Label_CC = string_to_label("CC");
	if (is_label_string("CD")) _Label_CD = string_to_label("CD");
	if (is_label_string("COLON")) _Label_COLON = string_to_label(":");
	if (is_label_string("COMMA")) _Label_COMMA = string_to_label(",");
	if (is_label_string("CONJP")) _Label_CONJP = string_to_label("CONJP");
	if (is_label_string("DOLLAR")) _Label_DOLLAR = string_to_label("$");
	if (is_label_string("DT")) _Label_DT = string_to_label("DT");
	if (is_label_string("EX")) _Label_EX = string_to_label("EX");
	if (is_label_string("FRAG")) _Label_FRAG = string_to_label("FRAG");
	if (is_label_string("FW")) _Label_FW = string_to_label("FW");
	if (is_label_string("HASH")) _Label_HASH = string_to_label("#");
	if (is_label_string("IN")) _Label_IN = string_to_label("IN");
	if (is_label_string("INTJ")) _Label_INTJ = string_to_label("INTJ");
	if (is_label_string("JJ")) _Label_JJ = string_to_label("JJ");
	if (is_label_string("JJR")) _Label_JJR = string_to_label("JJR");
	if (is_label_string("JJS")) _Label_JJS = string_to_label("JJS");
	if (is_label_string("LS")) _Label_LS = string_to_label("LS");
	if (is_label_string("LST")) _Label_LST = string_to_label("LST");
	if (is_label_string("MD")) _Label_MD = string_to_label("MD");
	if (is_label_string("NAC")) _Label_NAC = string_to_label("NAC");
	if (is_label_string("NN")) _Label_NN = string_to_label("NN");
	if (is_label_string("NNP")) _Label_NNP = string_to_label("NNP");
	if (is_label_string("NNPS")) _Label_NNPS = string_to_label("NNPS");
	if (is_label_string("NNS")) _Label_NNS = string_to_label("NNS");
	if (is_label_string("NP")) _Label_NP = string_to_label("NP");
	if (is_label_string("NPB")) _Label_NPB = string_to_label("NPB");
	if (is_label_string("NX")) _Label_NX = string_to_label("NX");
	if (is_label_string("POS")) _Label_POS = string_to_label("POS");
	if (is_label_string("PP")) _Label_PP = string_to_label("PP");
	if (is_label_string("PRN")) _Label_PRN = string_to_label("PRN");
	if (is_label_string("PRP")) _Label_PRP = string_to_label("PRP");
	if (is_label_string("PRPP")) _Label_PRPP = string_to_label("PRP$");
	if (is_label_string("PRT")) _Label_PRT = string_to_label("PRT");
	if (is_label_string("QP")) _Label_QP = string_to_label("QP");
	if (is_label_string("RB")) _Label_RB = string_to_label("RB");
	if (is_label_string("RBR")) _Label_RBR = string_to_label("RBR");
	if (is_label_string("RBS")) _Label_RBS = string_to_label("RBS");
	if (is_label_string("RP")) _Label_RP = string_to_label("RP");
	if (is_label_string("RRC")) _Label_RRC = string_to_label("RRC");
//.........这里部分代码省略.........
开发者ID:arne-cl,项目名称:turian-parser,代码行数:101,代码来源:vocabulary.C

示例7: main

int main(int argc, char * * argv) {

	typedef CircularBuffer< uint32_t, 4 > CIRCULAR_BUFFER;

	typedef std::pair< CIRCULAR_BUFFER, uint32_t > PAIR;
	typedef std::list< PAIR > LIST;

	LIST stack;

	CIRCULAR_BUFFER b(0);

	uint32_t i = 2,
		j = 1,

		k = 3,
		l = 0,
		m = 0;

	b = j;
	b += i;

	const uint32_t M(1000000),
		T(M * 3 + 1);

	while (true) {

		while (i > 1 && i < T) {

			j = i;
			i = (j - 1) / 3;

			if (i == 1 || i * 3 + 1 != j || i % 2 == 0) {
				i = 2 * j;

			} else {
				stack.push_back(PAIR(b, k));
			}
			
			b += i;
			k++;
		}

		for (i = 0, k -= b.SIZE; i < b.SIZE; i++, k++) {

			if (b[i] < M && l < k) {
				m = b[i];
				l = k;
			}
		}

		if (stack.empty()) {
			break;

		} else {
			stack.pop_front();

			b = stack.front().first;
			k = stack.front().second;

			j = b[b.SIZE - 1];
			i = 2 * j;

			b += i;
			k++;
		}
	}

	std::cout << m << " " << l << std::endl;
}
开发者ID:dmorilha,项目名称:euler,代码行数:69,代码来源:14.cpp


注:本文中的LIST::push_back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。