本文整理汇总了C++中Cells::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Cells::push_back方法的具体用法?C++ Cells::push_back怎么用?C++ Cells::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cells
的用法示例。
在下文中一共展示了Cells::push_back方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AbstractProblem
ConcreteProblem::ConcreteProblem(ConcreteProblemPtr parentProblemPtr, AbstractSolutionStepPtr solutionStepPtr) : AbstractProblem(parentProblemPtr->m_numberOfRow, parentProblemPtr->m_numberOfColumn) {
m_freeCellPtrs = parentProblemPtr->m_freeCellPtrs;
Cell cell1UsedByStep, cell2UsedByStep;
solutionStepPtr->getCells(cell1UsedByStep, cell2UsedByStep);
Cells cellsUsedByStep;
cellsUsedByStep.push_back(cell1UsedByStep);
cellsUsedByStep.push_back(cell2UsedByStep);
regiterBlockedCells(cellsUsedByStep);
}
示例2: CreateRandomCells
Cells CreateRandomCells(int rowCount, int columnCount) {
Cells cells;
for (int i = 0; i < rowCount; i++) {
vector<bool> row;
for (int j = 0; j < columnCount; j++) {
row.push_back(GetRandomBool());
}
cells.push_back(row);
}
return cells;
}
示例3: get_neighbors
void SpatialHash::get_neighbors(Index ctr, Cells& neighbors) const
{
Index idx;
for (int k = -1; k <= 1; ++k) {
idx[0] = ctr[0] + k;
for (int j = -1; j <= 1; ++j) {
idx[1] = ctr[1] + j;
for (int i = -1; i <= 1; ++i) {
idx[2] = ctr[2] + i;
Pts* cell = this->cells_[offset_of(idx)];
neighbors.push_back(cell);
}
}
}
}
示例4: ReadCellsFromFile
Cells ReadCellsFromFile(string path) {
Cells cells;
ifstream file(path.c_str());
string line;
while (file) {
std::getline(file, line);
vector<bool> cellsRow;
for (int i = 0; i < line.size(); i += 2) {
if (line[i] == '~') {
cellsRow.push_back(false);
} else if (line[i] == '#') {
cellsRow.push_back(true);
}
}
if (!cellsRow.empty()) {
cells.push_back(cellsRow);
}
}
file.close();
return cells;
}