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


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

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


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

示例1:

typename T2::iterator copy_safe_apart(size_t n, const T1 & tab_src, T2 & tab_dst, size_t offset_src=0, size_t offset_dst=0) {
	_dbg5("copy (tab) n="<<n);
	if (n<1) return tab_dst.begin();

	// could write both blocks below with lambda, in C++17TODO when decomposition declarations is available

	// source
	auto src_rb = tab_src.begin() + offset_src; // rb = range begin
	_check_input( offset_src < tab_src.size() );
	_check_input( n <= tab_src.size() - offset_src ); // subtracting offset_src is valid since above
	auto src_rl = tab_src.begin() + offset_src + n -1; // range last
	_dbg5("Source     range src_rb="<<to_debug(src_rb)<<" ... src_rl="<<to_debug(src_rl));
	_check_abort( src_rl <= tab_src.end() );

	// dest
	auto dst_rb = tab_dst.begin() + offset_dst; // rb = range begin
	_check_input( offset_dst < tab_dst.size() );
	_check_input( n <= tab_dst.size() - offset_dst ); // subtracting offset_dst is valid since above
	auto dst_rl = tab_dst.begin() + offset_dst + n -1; // range last
	_dbg5("Destintion range dst_rb="<<to_debug(dst_rb)<<" ... dst_rl="<<to_debug(dst_rl));
	_check_abort( dst_rl <= tab_dst.end() );

	bool overlap = test_ranges_overlap_inclusive_noempty(src_rb, src_rl,  dst_rb, dst_rl);
	_dbg5("overlap=" << overlap);
	_check_input(!overlap);

	copy_iter_and_check_no_overlap( src_rb, src_rl,  dst_rb, n );
	_dbg5("Copy done.");

	return dst_rb;
}
开发者ID:robertoleksy,项目名称:galaxy42,代码行数:31,代码来源:tab.hpp

示例2: UpdateItem

void UpdateItem(WORD32 dwKey, T2 &vec, T1 *pData)
{
	T1 *pInfo = NULL;
	SNMP_PERF_VEC_IT it;
	for(it = vec.begin(); it != vec.end(); it++)
	{
		if((*it).dwKey == dwKey)
		{
			pInfo = &(*it);
			check_paranullpt(pInfo);
			memset(pInfo, 0, sizeof(*pInfo));
			memcpy(pInfo, pData, sizeof(*pInfo));
			printf("updateitem, update data, key:%#x\n", dwKey);
			return;
		}
	}
	
	// pInfo = new T1();
	pInfo = &g_snmptest;
	check_paranullpt(pInfo);
	memset(pInfo, 0, sizeof(*pInfo));
	memcpy(pInfo, pData, sizeof(*pInfo));
	vec.push_back(*pInfo);
	printf("updateitem, create data, key:%#x, new addr:%p\n", dwKey, pInfo);

}
开发者ID:weilaidb,项目名称:qtexample,代码行数:26,代码来源:vector_addr.cpp

示例3: insertSort

void insertSort( T1& nums, T2& vecnum)
{
	for(auto lit = nums.begin(); lit!=nums.end(); lit++)
	{
		if(vecnum.size()==0) vecnum.push_back(*lit);
		else
		{
			auto vit = vecnum.begin(); //vector iterator
			while(*vit<*lit && vit!=vecnum.end())
				vit++;
			vecnum.insert(vit, *lit);
		}
	}
}
开发者ID:saniaarif22,项目名称:CPlusPlus,代码行数:14,代码来源:allSort.cpp

示例4: range_error

typename T1::ScalarType scalarProduct(const T1& v1,const T2& v2)
{
  if(v1.dimension()!=v2.dimension())
    throw std::range_error("chomp::vectalg::scalarProduct: Incompatible dimensions");
  typename T1::ScalarType result(0);
  typename T1::const_iterator b1=v1.begin();
  typename T2::const_iterator b2=v2.begin(), e2=v2.end();
  while(b2!=e2)
  {
    result += (*b1) * (*b2);
    ++b1;
    ++b2;
  }
  return result;
}
开发者ID:caosuomo,项目名称:rads,代码行数:15,代码来源:algebraicOperations.hpp

示例5: RemoveItem

void RemoveItem(WORD32 dwKey, T2 &vec)
{
	T1 *pInfo = NULL;
	SNMP_PERF_VEC_IT it;
	for(it = vec.begin(); it != vec.end(); it++)
	{
		if((*it).dwKey == dwKey)
		{
			pInfo = &(*it);
			check_paranullpt(pInfo);
			vec.erase(it);
			printf("removeitem, remove ok, key:%#x\n", dwKey);
			return;
		}
	}
	printf("removeitem, no data, key:%#x\n", dwKey);
}
开发者ID:weilaidb,项目名称:qtexample,代码行数:17,代码来源:vector_addr.cpp

示例6: catch

template <typename T1, typename T2> void merge_exception_test(T1 x, T2 y)
{
    std::size_t size = x.size() + y.size();

    try {
        ENABLE_EXCEPTIONS;
        x.merge(y);
    } catch (...) {
        test::check_equivalent_keys(x);
        test::check_equivalent_keys(y);
        throw;
    }

    // Not a full check, just want to make sure the merge completed.
    BOOST_TEST(size == x.size() + y.size());
    if (y.size()) {
        BOOST_TEST(test::has_unique_keys<T1>::value);
        for (typename T2::iterator it = y.begin(); it != y.end(); ++it) {
            BOOST_TEST(x.find(test::get_key<T2>(*it)) != x.end());
        }
    }
    test::check_equivalent_keys(x);
    test::check_equivalent_keys(y);
}
开发者ID:,项目名称:,代码行数:24,代码来源:

示例7: CmpHelperEqRange

::iutest::AssertionResult IUTEST_ATTRIBUTE_UNUSED_ CmpHelperEqRange(const char* expected_expr, const char* actual_expr
    , const ::std::initializer_list<T1>& expected, const T2& actual)
{
    return detail::CmpHelperEqRange(expected_expr, actual_expr, expected.begin(), expected.end()
        , actual.begin(), actual.end());
}
开发者ID:,项目名称:,代码行数:6,代码来源:


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