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


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

本文整理汇总了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;
        }
    }
}
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:35,代码来源:NamespacesHandler.cpp

示例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);
}
开发者ID:Antonius32,项目名称:Pale-Moon,代码行数:8,代码来源:HangMonitor.cpp

示例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);
	}
开发者ID:wheeland,项目名称:pgasus,代码行数:8,代码来源:synced_containers.hpp

示例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();
}
开发者ID:g1257,项目名称:PsimagLite,代码行数:19,代码来源:akimaSpline.cpp

示例5:

VPFactory::VectorType
	VPFactory::getFlowKeys() const
{
	VectorType	retVector;

	for ( FlowDBConstIter it = flowDB.begin();
		  it != flowDB.end();
		  it ++ )
	{
		retVector.push_back( it->flowName );
	}

	return retVector;
}
开发者ID:andreaswatch,项目名称:dizuo,代码行数:14,代码来源:vpfactory.cpp

示例6: nsString

void
ChromeHangAnnotations::AddAnnotation(const nsAString& aName, const nsAString& aData)
{
  AnnotationType annotation = std::make_pair(nsString(aName), nsString(aData));
  mAnnotations.push_back(annotation);
}
开发者ID:Antonius32,项目名称:Pale-Moon,代码行数:6,代码来源:HangMonitor.cpp

示例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;
}
开发者ID:Symcies,项目名称:RiemAlzh,代码行数:80,代码来源:ReadData.cpp


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