本文整理汇总了C++中VectorType::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ VectorType::push_back方法的具体用法?C++ VectorType::push_back怎么用?C++ VectorType::push_back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VectorType
的用法示例。
在下文中一共展示了VectorType::push_back方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findByPrefixNonConst
bool
addOrUpdateByPrefix(
StylesheetConstructionContext& theConstructionContext,
VectorType& theVector,
const XalanDOMString& thePrefix,
const XalanDOMString& theURI)
{
typedef typename VectorType::value_type value_type;
value_type* const theEntry =
findByPrefixNonConst(theVector, thePrefix);
if (theEntry == 0)
{
theVector.push_back(
value_type(
theConstructionContext.getPooledString(thePrefix),
theConstructionContext.getPooledString(theURI)));
return true;
}
else
{
if (theEntry->getURI() == theURI)
{
return false;
}
else
{
theEntry->setURI(theConstructionContext.getPooledString(theURI));
return true;
}
}
}
示例2:
void
ChromeHangAnnotations::AddAnnotation(const nsAString& aName, const bool aData)
{
nsString dataString;
dataString += aData ? NS_LITERAL_STRING("true") : NS_LITERAL_STRING("false");
AnnotationType annotation = std::make_pair(nsString(aName), dataString);
mAnnotations.push_back(annotation);
}
示例3: put
void put(T *t) {
std::lock_guard<Lock> l(_lock);
_data.push_back(t);
std::sort(_data.begin(), _data.end(), Comparator());
assert(sem_post(&_count) == 0);
}
示例4: readTwoColumnData
void readTwoColumnData(const String& file,VectorType& v0,VectorType& v1)
{
std::ifstream fin(file.c_str());
if (!fin || !fin.good() || fin.bad()) throw
RuntimeError("Cannot open file\n");
while(!fin.eof()) {
String s;
fin>>s;
if (s[0]=='#') continue;
FieldType x = std::atof(s.c_str());
SizeType size=v0.size();
if (size>1 && x<v0[size-1]) break;
v0.push_back(x);
fin>>s;
if (s[0]=='#') continue;
v1.push_back(atof(s.c_str()));
}
fin.close();
}
示例5:
VPFactory::VectorType
VPFactory::getFlowKeys() const
{
VectorType retVector;
for ( FlowDBConstIter it = flowDB.begin();
it != flowDB.end();
it ++ )
{
retVector.push_back( it->flowName );
}
return retVector;
}
示例6: nsString
void
ChromeHangAnnotations::AddAnnotation(const nsAString& aName, const nsAString& aData)
{
AnnotationType annotation = std::make_pair(nsString(aName), nsString(aData));
mAnnotations.push_back(annotation);
}
示例7: IndivID
Observations
ReadData
::ReadObservations(DataSettings &DS)
{
Observations Obs;
std::ifstream IndivID(DS.GetPathToGroup());
std::ifstream TimePointsFile(DS.GetPathToTimepoints());
std::ifstream LandmarksFile(DS.GetPathToLandmarks());
std::ifstream CognitiveScoresFile(DS.GetPathToCognitiveScores());
std::string GroupLine, TimePointsLine, LandmarksLine, CognitiveScoresLine;
unsigned int CurrentSubjectID = -1;
VectorType TimePoints;
std::vector<VectorType> Landmarks;
std::vector<VectorType> CognitiveScores;
while(getline(IndivID, GroupLine))
{
if(CurrentSubjectID == -1) CurrentSubjectID = std::stoi(GroupLine);
unsigned int NewSubjectID = std::stoi(GroupLine);
getline(TimePointsFile, TimePointsLine);
if(DS.LandmarkPresence()) getline(LandmarksFile, LandmarksLine);
if(DS.CognitiveScoresPresence()) getline(CognitiveScoresFile, CognitiveScoresLine);
/// New subject
if(NewSubjectID != CurrentSubjectID)
{
IndividualObservations Individual(TimePoints);
if(DS.LandmarkPresence()) Individual.AddLandmarks(Landmarks);
if(DS.CognitiveScoresPresence()) Individual.AddCognitiveScores(CognitiveScores);
Obs.AddIndividualData(Individual);
CurrentSubjectID = NewSubjectID;
TimePoints.clear();
Landmarks.clear();
CognitiveScores.clear();
}
TimePoints.push_back(stod(TimePointsLine));
if(DS.LandmarkPresence())
{
VectorType NewObs(DS.GetLandmarksDimension());
int i = 0;
std::stringstream LineStream(LandmarksLine);
std::string cell;
while(std::getline(LineStream, cell, ','))
{
NewObs(i) = std::stod(cell);
++i;
}
Landmarks.push_back(NewObs);
}
if(DS.CognitiveScoresPresence())
{
VectorType NewObs(DS.GetCognitiveScoresDimension());
int i = 0;
std::stringstream LineStream(CognitiveScoresLine);
std::string cell;
while(std::getline(LineStream, cell, ','))
{
NewObs(i) = std::stod(cell);
++i;
}
CognitiveScores.push_back(NewObs);
}
}
IndividualObservations Individual(TimePoints);
if(DS.LandmarkPresence()) Individual.AddLandmarks(Landmarks);
if(DS.CognitiveScoresPresence()) Individual.AddCognitiveScores(CognitiveScores);
Obs.AddIndividualData(Individual);
return Obs;
}