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


C++ multiset::end方法代码示例

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


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

示例1: save

bool Serialization::save(std::multiset<Event *, Cmp_event_day> &events)
{
    //Save file to disk
    QFile file("events.txt");
    if(!file.open(QIODevice::WriteOnly))
    {
        qDebug() << "Could not open file";
        return false;
    }

    //create output stream
    QDataStream out (&file);
    //set output version
    out.setVersion(QDataStream::Qt_4_8);

    //iteration
    std::multiset<Event *>::iterator it;
    for ( it=events.begin() ; it != events.end(); it++ )
        out << **it;

    //Finito! flush the stream to the file and close
    file.flush();
    file.close();
    return true;
}
开发者ID:CDargis,项目名称:Roto-Cal,代码行数:25,代码来源:serialization.cpp

示例2: RemoveNeighbours

void ExpMapGenerator::RemoveNeighbours( ExpMapParticle * pParticle, std::multiset< ParticleQueueWrapper > & pq )
{
	ExpMapParticle::ListEntry * pCur = GetNeighbourList( pParticle );
	if ( pCur == NULL ) lgBreakToDebugger();
	while ( pCur != NULL ) {

		ExpMapParticle * pCurParticle = pCur->pParticle;
		pCur = pCur->pNext;

		if ( pCurParticle->State() != ExpMapParticle::Active )
			continue;

		// find entry in pq
#if 1
		std::multiset<ParticleQueueWrapper>::iterator found( 
			pq.find( ParticleQueueWrapper( pCurParticle->SurfaceDistance() ) ) );
		if ( found != pq.end() ) {

			while ( (*found).Particle() != pCurParticle &&
						(*found).QueueValue() == pCurParticle->SurfaceDistance() )
				++found;

			// [RMS: this should always happen...]
			lgASSERT( (*found).Particle() == pCurParticle );
			if ( (*found).Particle() == pCurParticle ) {
				pq.erase( found );
			}
		} else {
			lgASSERT( found != pq.end() );
		}

#else 
		std::multiset<ParticleQueueWrapper>::iterator cur( pq.begin() );
		bool bFound = false;
		while ( !bFound && cur != pq.end() ) {
			if ( (*cur).Particle() == pCurParticle ) {
				pq.erase( cur );
				bFound = true;
			} else
				++cur;
		}
		lgASSERT( bFound );
#endif

	}
}
开发者ID:rms80,项目名称:libgeometry,代码行数:46,代码来源:ExpMapGenerator.cpp

示例3: populateMultiset

void populateMultiset(std::multiset<sdEvent*, sdEventCompare> eventSet) {
    std::multiset <sdEvent*, sdEventCompare>::iterator eit = eventSet.begin();
    while(eit != eventSet.end()) {
        sdEvent* event = *eit;
        std::cout << "   " << event->getTime() << ":" << event->getDescriptorAsString() << " " << event->getValueAsString() << std::endl;
        eit++;
    }
}
开发者ID:rodrigodzf,项目名称:libspatdif-android,代码行数:8,代码来源:sdExtensionTest.cpp

示例4: main

int main()
{
    typedef test_compare<std::less<int> > C;
    const std::multiset<int, C> m(C(3));
    assert(m.empty());
    assert(m.begin() == m.end());
    assert(m.key_comp() == C(3));
    assert(m.value_comp() == C(3));
}
开发者ID:CaseyCarter,项目名称:libcxx,代码行数:9,代码来源:compare.pass.cpp

示例5: find_and_remove

static bool find_and_remove(std::multiset<std::string>& files,
		const std::string& filename)
{
	std::multiset<std::string>::iterator ptr;
	if ( (ptr = files.find(filename)) != files.end())
	{
		//erase(filename) erases *all* entries with that key
		files.erase(ptr);
		return true;
	}
	return false;
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:12,代码来源:llxfermanager.cpp

示例6: PrettyPrint

 inline std::string PrettyPrint(const std::multiset<T>& settoprint, const bool add_delimiters=false, const std::string& separator=", ")
 {
     std::ostringstream strm;
     if (settoprint.size() > 0)
     {
         if (add_delimiters)
         {
             strm << "(";
             typename std::multiset<T, Compare, Allocator>::const_iterator itr;
             for (itr = settoprint.begin(); itr != settoprint.end(); ++itr)
             {
                 if (itr != settoprint.begin())
                 {
                     strm << separator << PrettyPrint(*itr, add_delimiters, separator);
                 }
                 else
                 {
                     strm << PrettyPrint(*itr, add_delimiters, separator);
                 }
             }
             strm << ")";
         }
         else
         {
             typename std::multiset<T, Compare, Allocator>::const_iterator itr;
             for (itr = settoprint.begin(); itr != settoprint.end(); ++itr)
             {
                 if (itr != settoprint.begin())
                 {
                     strm << separator << PrettyPrint(*itr, add_delimiters, separator);
                 }
                 else
                 {
                     strm << PrettyPrint(*itr, add_delimiters, separator);
                 }
             }
         }
     }
     return strm.str();
 }
开发者ID:orthez,项目名称:arc_utilities,代码行数:40,代码来源:pretty_print.hpp

示例7: checkTrajectoriesForCollision

bool TrajectoryEvaluator::checkTrajectoriesForCollision(const std::multiset<PolyTraj2D, PolyTraj2D::CompPolyTraj2D>& traj_set,
    const std::map<int, Vehicle>& predicted_obstacles, const std::string set_name,
    std::multiset<PolyTraj2D>::const_iterator& best_traj, double& longest_time_to_collision) {

  bool collision = true, found_maybe = false;
  double collision_time;
  longest_time_to_collision = 0;
  std::multiset<PolyTraj2D>::const_iterator it_traj;
  uint32_t j = 0;
  for (it_traj = traj_set.begin(), j = 0; it_traj != traj_set.end(); it_traj++, j++) {

    TrjOccupancyState_t static_collision = TRJ_BLOCKED;
    if (obstacle_map_) {
      pthread_mutex_lock(&obstacle_map_mutex_);
      static_collision = checkCollisionStatic(it_traj->trajectory2D_); // TODO: add collision_time and longest_time_to_collision to static check
      pthread_mutex_unlock(&obstacle_map_mutex_);

      if (static_collision==TRJ_BLOCKED) {
        continue;
      }
//      std::vector<driving_common::TrajectoryPoint2D>::const_iterator tit = it_traj->trajectory2D_.begin(), tit_end = it_traj->trajectory2D_.end();
//      bool zero_velocity=true;
//      for(; tit!=tit_end; tit++) {
//      if(std::abs((*tit).v)>.01) {zero_velocity=false; break;}
//      }
//      if(zero_velocity) {continue;}
    }

    if (!checkCollisionOfTrajectoriesDynamic(it_traj->trajectory2D_, predicted_obstacles, collision_time)) {
      if (j != 0) {std::cout << j << "th trajectory (" << set_name << ") of " << traj_set.size() << " is free.\n";}
      longest_time_to_collision = std::numeric_limits<double>::infinity();
        // we found a collision-free trajectory regardless if it's in maybe range or not
      collision = false;
        // if we did not find any free before or we found a free now and had a maybe before => update best trajectory
      if(!found_maybe || static_collision==TRJ_FREE) {best_traj = it_traj;}
        // if there are only maybes we want the one that was found first since it's the best :-)
        // otherwise we found a free one and are done
      if(static_collision==TRJ_MAYBE_BLOCKED) {found_maybe=true;}
      else {
        break;
      }
    }
    else {
      if (collision_time > longest_time_to_collision) {
        longest_time_to_collision = collision_time;
        best_traj = it_traj;
      }
    }
  }

  return collision;
}
开发者ID:Forrest-Z,项目名称:stanford_self_driving_car_code,代码行数:52,代码来源:trajectoryEvaluator.cpp

示例8: judgeStatus

		virtual Json::Value judgeStatus()
		{
			Json::Value ret;
			ret["runningCnt"]=runningCnt;
			ret["totDumpCmdCnt"]=totCnt;
			ret["preserveCnt"]=preserveCnt;
			ret["boardingPass"]=Json::Value();
			pthread_mutex_lock(&cntLock);
			for (std::multiset<int>::iterator i=boardingPass.begin(); i!=boardingPass.end(); i++)
				ret["boardingPass"].append(*i);
			pthread_mutex_unlock(&cntLock);
			return ret;
		}
开发者ID:roastduck,项目名称:YAUJ,代码行数:13,代码来源:daemon.cpp

示例9: total

double Basket::total() const
{
    double sum = 0.0;

    for(const_iter i = items.begin() ;  i != items.end() ; i = items.upper_bound(*i))
    {
        sum += (*i)->net_price(items.count(*i));
    }


    return sum;

}
开发者ID:QiJunHu,项目名称:learningRecord,代码行数:13,代码来源:learningHandleClass.cpp

示例10: unique

inline void converter<point_t>::knot_insertion(
    point_container_t& P,
    std::multiset<typename point_t::value_type>& knots,
    std::size_t order) const {
  //typedef typename point_t::value_type value_type;
  std::set<value_type> unique(knots.begin(), knots.end());

  for (typename std::set<value_type>::const_iterator i = unique.begin();
       i != unique.end();
       ++i) {
    if (knots.count(*i) < order - 1) {
      knot_insertion(P, knots, order, *i);
    }
  }
}
开发者ID:4og,项目名称:guacamole,代码行数:15,代码来源:converter_impl.hpp

示例11: main

int main(){
    // read input
    scanf("%d",&N);
    for(int i=0;i<N;++i)
        scanf("%lld%lld",&P[i].x,&P[i].y);
    // sort points by x-coordinate
    std::sort(P,P+N);
    for(int i=0,j=0;i<N;++i){
        while(j<i&&P[i].x-P[j].x>ans)
            // these points should not be considered
            // so remove them from the active set
            bbst.erase(bbst.lower_bound(P[j++]));
        for(auto x=bbst.lower_bound(pnt(P[i].x-ans,P[i].y-ans));x!=bbst.end()&&x->y<=P[i].y+ans;++x)
            // this algorithm looks like it should take O(N^2), but the number of iterations is actually constant
            ans=std::min(ans,dist(P[i],*x));
        // insert into the active set
        bbst.insert(P[i]);
    }
    printf("%lld\n",ans);
}
开发者ID:BinAccel,项目名称:competitive-programming,代码行数:20,代码来源:MinPairwiseDistance.cpp

示例12: impl_diag

 matrix<T> const diag( const std::multiset<T,C,A>& v, const std::ptrdiff_t offset = 0 )
 {
     return diag_private::impl_diag( v.begin(), v.end(), offset );
 }
开发者ID:fengwang,项目名称:larbed-refinement,代码行数:4,代码来源:diag.hpp

示例13: hash_value

 std::size_t hash_value(std::multiset<K, C, A> const& v)
 {
     return hash_range(v.begin(), v.end());
 }
开发者ID:4eek,项目名称:xtractorfan,代码行数:4,代码来源:set.hpp

示例14: main

int main()
{
    {
        typedef int V;
        V ar[] =
        {
            1,
            1,
            1,
            2,
            2,
            2,
            3,
            3,
            3,
            4,
            4,
            4,
            5,
            5,
            5,
            6,
            6,
            6,
            7,
            7,
            7,
            8,
            8,
            8
        };
        std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
        assert(std::distance(m.begin(), m.end()) == m.size());
        assert(std::distance(m.rbegin(), m.rend()) == m.size());
        std::multiset<int>::iterator i;
        i = m.begin();
        std::multiset<int>::const_iterator k = i;
        assert(i == k);
        for (int j = 1; j <= 8; ++j)
            for (int k = 0; k < 3; ++k, ++i)
                assert(*i == j);
    }
    {
        typedef int V;
        V ar[] =
        {
            1,
            1,
            1,
            2,
            2,
            2,
            3,
            3,
            3,
            4,
            4,
            4,
            5,
            5,
            5,
            6,
            6,
            6,
            7,
            7,
            7,
            8,
            8,
            8
        };
        const std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0]));
        assert(std::distance(m.begin(), m.end()) == m.size());
        assert(std::distance(m.cbegin(), m.cend()) == m.size());
        assert(std::distance(m.rbegin(), m.rend()) == m.size());
        assert(std::distance(m.crbegin(), m.crend()) == m.size());
        std::multiset<int, double>::const_iterator i;
        i = m.begin();
        for (int j = 1; j <= 8; ++j)
            for (int k = 0; k < 3; ++k, ++i)
                assert(*i == j);
    }
}
开发者ID:32bitmicro,项目名称:libcxx,代码行数:83,代码来源:iterator.pass.cpp

示例15: Qw

inline void converter<point_t>::knot_insertion(point_container_t& P,
                                               std::multiset<value_type>& knots,
                                               std::size_t order,
                                               value_type t) const {
  typedef typename point_t::value_type value_type;

  // copy knotvector for subscript [] access
  std::vector<value_type> kv_cpy(knots.begin(), knots.end());
  // get parameter
  std::size_t p = order - 1;                        // degree
  std::size_t s = knots.count(t);                   // multiplicity
  std::size_t r = std::max(std::size_t(0), p - s);  // number of insertions

  // get knotspan
  std::size_t k = std::distance(knots.begin(), knots.upper_bound(t));
  std::size_t np = P.size();  // number of control points

  // start computation
  std::size_t nq = np + r;

  // helper arrays
  std::vector<point_t> Qw(nq);
  std::vector<point_t> Rw(p - s + 1);

  // copy unaffected points and transform into homogenous coords
  for (size_t i = 0; i <= k - p; ++i) {
    Qw[i] = P[i].as_homogenous();
  }
  for (size_t i = k - s - 1; i <= np - 1; ++i) {
    Qw[i + r] = P[i].as_homogenous();
  }

  // helper points
  for (size_t i = 0; i <= p - s; ++i) {
    Rw[i] = P[k - p + i - 1].as_homogenous();
  }

  // do knot insertion itself
  std::size_t L = 0;
  for (std::size_t j = 1; j <= r; ++j) {
    L = k - p + j;
    for (std::size_t i = 0; i <= p - j - s; ++i) {
      value_type alpha =
          (t - kv_cpy[L + i - 1]) / (kv_cpy[i + k] - kv_cpy[L + i - 1]);
      Rw[i] = alpha * Rw[i + 1] + value_type(1.0 - alpha) * Rw[i];
    }
    Qw[L - 1] = Rw[0];
    Qw[k + r - j - s - 1] = Rw[p - j - s];
  }

  // insert knots
  for (std::size_t i = 0; i < r; ++i) {
    knots.insert(t);
  }

  // copy new control points
  P.clear();

  // transform back to euclidian space
  for (typename std::vector<point_t>::iterator i = Qw.begin(); i != Qw.end();
       ++i) {
    P.push_back((*i).as_euclidian());
  }
}
开发者ID:4og,项目名称:guacamole,代码行数:64,代码来源:converter_impl.hpp


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