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


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

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


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

示例1: append_and_preserve_iter

 void append_and_preserve_iter(Sequence &s, const Sequence &r,
                               Iterator &, std::forward_iterator_tag)
 {
     // Here we boldly assume that anything that is not random-access
     // preserves validity. This is valid for the STL sequences.
     s.insert(s.end(), r.begin(), r.end());
 }
开发者ID:BloodAxe,项目名称:opencv-ios-template-project,代码行数:7,代码来源:string_path.hpp

示例2: getLongestCommonPrefix

int getLongestCommonPrefix(const Sequence &A, const Sequence &B)
{
	auto it = A.begin();
	auto jt = B.begin();
	while (it != A.end() && jt != B.end())
		if ((*it) != (*jt)) return it - A.begin();
		else it++, jt++;
	return it - A.begin();
}
开发者ID:apronchenkov,项目名称:mipt-oop-399-2,代码行数:9,代码来源:main.cpp

示例3: erase_unordered

void erase_unordered( Sequence& s, typename Sequence::iterator pos )
{
  assert( ! s.empty() && pos != s.end() );
  typename Sequence::iterator last = s.end();
  --last;
  if ( pos != last )
    *pos = *last; // *pos = std::move( *last );
  s.pop_back();
}
开发者ID:JamesWR,项目名称:simc,代码行数:9,代码来源:generic.hpp

示例4: erase_if_dispatch

  void erase_if_dispatch(Sequence& c, Predicate p,
                         sequence_tag, IteratorStability)
  {
#if 0
    c.erase(std::remove_if(c.begin(), c.end(), p), c.end());
#else
    if (! c.empty())
      c.erase(std::remove_if(c.begin(), c.end(), p), c.end());
#endif
  }
开发者ID:2asoft,项目名称:xray-16,代码行数:10,代码来源:container_traits.hpp

示例5: if

vector<Operation> getModifiedOperationSequence(const Sequence &left_data_sequence, const Sequence &right_data_sequence)
{
	vector<Operation> result;
	assert(left_data_sequence.size() == right_data_sequence.size() + 1 || left_data_sequence.size() + 1 == right_data_sequence.size());
	auto ptr1 = left_data_sequence.begin(), ptr2 = right_data_sequence.begin();
	while (ptr1 != left_data_sequence.end() && ptr2 != right_data_sequence.end())
		if ((*ptr1) == (*ptr2)) result.push_back(Operation(*(ptr1), 0)), ptr1++, ptr2++;
		else if (left_data_sequence.size() == right_data_sequence.size() + 1) result.push_back(Operation(*(ptr1), -1)), ptr1++;
		else result.push_back(Operation(*(ptr2), 1)), ptr2++;
	if (ptr1 != left_data_sequence.end()) result.push_back(Operation(*(ptr1), -1));
	if (ptr2 != right_data_sequence.end()) result.push_back(Operation(*(ptr2), 1));
	return result;
}
开发者ID:apronchenkov,项目名称:mipt-oop-399-2,代码行数:13,代码来源:main.cpp

示例6: compute_stats

void compute_stats(Sequence<double,Allocator>& value_list)
{
   //Format: min max sum mean median
   double min_value = 0.0;
   double max_value = 0.0;
   strtk::min_max_of_cont(value_list,min_value,max_value);
   std::cout << min_value << "\t" << max_value << "\t";

   double sum = std::accumulate(value_list.begin(),value_list.end(),0.0);
   std::cout << sum << "\t";
   std::cout << sum / value_list.size()  << "\t";

   std::nth_element(value_list.begin(),value_list.begin() + (value_list.size() / 2), value_list.end());
   std::cout << *(value_list.begin() + (value_list.size() / 2)) << "\t";
}
开发者ID:aardvarkk,项目名称:hockey_picks,代码行数:15,代码来源:strtk_numstats.cpp

示例7: main

int main(void)
{
	Sequence seq = { 0 }; // legnth = 0 으로 초기화

	seq.push_back(5);
	seq.push_back(4);
	seq.push_back(3);
	seq.push_back(2);
	seq.push_back(1);

	seq.push_front(6);

	cout <<"size: " <<seq.size() <<endl;
	cout <<"contents: ";
	for ( int* p = seq.begin(); p != seq.end(); p = seq.next(p) ) {
		cout <<*p <<" ";
	}
	cout <<endl;


#ifdef _MSC_VER // 윈도우즈 명령창이 닫혀서 쓰는 꼼수
	printf("\n\nPress Enter key to exit ...");
	getchar();
#endif

	return 0;
}
开发者ID:kyagrd,项目名称:eien233ds,代码行数:27,代码来源:SeqArray.cpp

示例8: it

void
sequence_iteration(
	Sequence &_sequence,
	UpdateAction const &_update_action
)
{
	for(
		auto it(
			_sequence.begin()
		);
		it != _sequence.end();
	)
	{
		switch(
			_update_action(
				*it
			)
		)
		{
		case fcppt::algorithm::update_action::remove:
			it =
				_sequence.erase(
					it
				);

			break;
		case fcppt::algorithm::update_action::keep:
			++it;

			break;
		}
	}
}
开发者ID:vinzenz,项目名称:fcppt,代码行数:33,代码来源:sequence_iteration.hpp

示例9:

Range<typename Sequence::value_type> make_range(const Sequence & sequence)
{
    typedef typename Sequence::value_type T; // TODO: in C++11 second template parameter class T = Sequence::value_type
    const Iterator<T> & begin = IteratorAdapter<T, typename Sequence::const_iterator>(sequence.begin());
    const Iterator<T> & end = IteratorAdapter<T, typename Sequence::const_iterator>(sequence.end());
    return Range<T>(begin, end);
}
开发者ID:RWTHmediTEC,项目名称:TRTK,代码行数:7,代码来源:Range.hpp

示例10: build_initial_sequences

// la séquence initiale est lue et découpée en sous-séquences de
// longueur 20 ;
// chaque sous-séquence est terminée par une observation END pour que
// le HMM généré possède un état terminal
Sequences build_initial_sequences(const std::string& name)
{
    Sequence sequence = read_initial_sequence(name, false);
    Sequences sequences;
    unsigned int length = sequence.size() / 20;
    Sequence::const_iterator it = sequence.begin();
    unsigned int added = 0;
    unsigned int index = 0;

    sequences.push_back(Sequence());
    while (it != sequence.end()) {
        if (added == length) {
            sequences[index].push_back(Observation(0, END));
            ++index;
            added = 0;
            sequences.push_back(Sequence());
        }
        sequences[index].push_back(*it);
        ++added;
        ++it;
    }
    if (sequence.size() % 20 != 0) {
        sequences[index].push_back(Observation(0, END));
    }
    return sequences;
}
开发者ID:devs-labs,项目名称:paradevs-learning,代码行数:30,代码来源:main.cpp

示例11: keySequence

QKeySequence KeyLogger::keySequence(const Sequence & sequence)
{
    int sum = std::accumulate(sequence.begin(),
                              sequence.end(),
                              0, std::plus<int>());
    return QKeySequence(sum);
}
开发者ID:Globidev,项目名称:ClipboardOne,代码行数:7,代码来源:KeyLogger.cpp

示例12: stitch

void Path::stitch(Sequence::iterator first_replaced,
                  Sequence::iterator last_replaced,
                  Sequence &source)
{
  if (!source.empty()) {
    if ( first_replaced != get_curves().begin() ) {
      if ( (*first_replaced)->initialPoint() != source.front()->initialPoint() ) {
        Curve *stitch = new StitchSegment((*first_replaced)->initialPoint(),
                                          source.front()->initialPoint());
        source.insert(source.begin(), boost::shared_ptr<Curve>(stitch));
      }
    }
    if ( last_replaced != (get_curves().end()-1) ) {
      if ( (*last_replaced)->finalPoint() != source.back()->finalPoint() ) {
        Curve *stitch = new StitchSegment(source.back()->finalPoint(),
                                          (*last_replaced)->finalPoint());
        source.insert(source.end(), boost::shared_ptr<Curve>(stitch));
      }
    }
  } else if ( first_replaced != last_replaced && first_replaced != get_curves().begin() && last_replaced != get_curves().end()-1) {
    if ( (*first_replaced)->initialPoint() != (*(last_replaced-1))->finalPoint() ) {
      Curve *stitch = new StitchSegment((*(last_replaced-1))->finalPoint(),
                                        (*first_replaced)->initialPoint());
      source.insert(source.begin(), boost::shared_ptr<Curve>(stitch));
    }
  }
}
开发者ID:Spin0za,项目名称:inkscape,代码行数:27,代码来源:path.cpp

示例13: getOperationSequence

vector<Operation> getOperationSequence(const Sequence &data_sequence, const int operation_type)
{
	vector<Operation> result;
	for (auto it = data_sequence.begin(); it != data_sequence.end(); it++)
		result.push_back(Operation((*it), operation_type));
	return result;
}
开发者ID:apronchenkov,项目名称:mipt-oop-399-2,代码行数:7,代码来源:main.cpp

示例14: multiply

ExprReturnSP LitMatrixExprReturn::multiply( LitMatrixExprReturn &litMatrixExprReturn ) {

	__int64 rows1, columns1;
	getRowsAndColumns( rows1, columns1 );

	__int64 rows2, columns2;
	litMatrixExprReturn.getRowsAndColumns( rows2, columns2 );

	if ( rows1 == 1 && columns1 == 1 ) {
		double multiplier = getSequence()[0];
		Sequence sequence = litMatrixExprReturn.getSequence();
		for( Sequence::iterator sqnItr = sequence.begin() ; sqnItr != sequence.end() ; (void)++sqnItr ) {
			*sqnItr *= multiplier;
		}
		return create( getBlock(), litMatrixExprReturn.getDT(), sequence );
	}

	if ( rows2 == 1 && columns2 == 1 ) {
		double multiplier = litMatrixExprReturn.getSequence()[0];
		Sequence sequence = getSequence();
		for( Sequence::iterator sqnItr = sequence.begin() ; sqnItr != sequence.end() ; (void)++sqnItr ) {
			*sqnItr *= multiplier;
		}
		return create( getBlock(), getDT(), sequence );
	}

	if ( columns1 != rows2 ) {
		if (  ( rows1 == 1 || columns1 == 1 ) && rows1 == rows2  ) std::swap( rows1, columns1 );
		else if (  ( rows2 == 1 || columns2 == 1 ) && columns1 == columns2  ) std::swap( rows2, columns2 ); 
		else { /* THROW ERROR */ }
	}

	Sequence sequence;
	Sequence &rhsSequence = litMatrixExprReturn.getSequence();
	for( long long ix = 0 ; ix < rows1 ; (void)++ix ) {
		for( long long jx = 0 ; jx < columns2 ; (void)++jx ) {
			double sum = 0;
			for( long long kx = 0 ; kx < columns1 ; (void)++kx ) {
				sum += getSequence()[ ix*rows1 + kx ] * rhsSequence[ kx*rows2 + jx ];
			}
			sequence.push_back( sum );
		}
	}

	SFC::DT dominantDT = SFCTypesManager::getDominantType( getDT(), litMatrixExprReturn.getDT() );
	return create( getBlock(), (int) rows1, (int) columns2, dominantDT, sequence );
}
开发者ID:pombreda,项目名称:metamorphosys-desktop,代码行数:47,代码来源:LitMatrixExprReturn.cpp

示例15: mark

void mark(
    MultiArray& m,const Sequence& pts,
    const point& p,int dx,int dy)
{
    for(int k=p.x<0||p.y<0||p.x>=m.shape()[0]||p.y>=m.shape()[1]?1:0,
            k_end=distZ2inf(p,pts.begin(),pts.end()); k<k_end; ++k) {
        int x=p.x-k*dx;
        int y=p.y-k*dy;
        if(x>=0&&y>=0&&x<m.shape()[0]&&y<m.shape()[1])m[x][y]=true;
    }
}
开发者ID:joaquintides,项目名称:bannalia,代码行数:11,代码来源:convexz2inf.cpp


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