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


C++ ContainerType类代码示例

本文整理汇总了C++中ContainerType的典型用法代码示例。如果您正苦于以下问题:C++ ContainerType类的具体用法?C++ ContainerType怎么用?C++ ContainerType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: makeMultiplicationWithNumbersAndDigit

void BigInt::makeMultiplicationWithNumbersAndDigit(const ContainerType& numbers, RankType digit, ContainerType& result)
{
	result.clear();
	result.push_back(0);
	if (0 == digit)
	{
		return;
	}
	else if (1 == digit)
	{
		result = numbers;
	}
	else
	{
		for (int rankIndex = 0; rankIndex < numbers.size(); rankIndex++)
		{
			RankType multiplication = numbers[rankIndex] * digit;
			if (result.size() == rankIndex)
			{
				result.push_back(multiplication % kBaseValue);
			}
			else
			{
				result[rankIndex] += multiplication % kBaseValue;
			}

			if (result[rankIndex] / kBaseValue)
			{
				result[rankIndex] %= kBaseValue;
				result.push_back(1);
			}

			if (multiplication / kBaseValue)
			{
				if (result.size() == rankIndex + 1)
				{
					result.push_back(multiplication / kBaseValue);
				}
				else
				{
					result[rankIndex + 1] += multiplication / kBaseValue;
				}
			}
		}
	}
}
开发者ID:Mmonya,项目名称:Katya_folder,代码行数:46,代码来源:BigInt.cpp

示例2: StringContainerToCharPtrArray

	void StringContainerToCharPtrArray(const ContainerType &container,
	unsigned int &out_count, char **&out_list, const char *name_string = NULL)
{
	out_count = 0;
	out_list  = NULL;

	if (!container.empty()) {
		C_ListTypeString<unsigned int> tmp_list;
		tmp_list.FromContainer(container, name_string);
		out_count = tmp_list.GetCount();
		out_list  = tmp_list.GetList();
		//	Mustn't try to free when we leave this scope...
		tmp_list.Reset();
	}
}
开发者ID:neilgroves,项目名称:MlbDev,代码行数:15,代码来源:C_StringSupport.hpp

示例3: isEqualToNumbers

bool BigInt::isEqualToNumbers(const ContainerType& numbers) const
{
	bool result = _numbers.size() == numbers.size();
	if (result)
	{
		for (int index = 0; index < _numbers.size(); index++)
		{
			if (_numbers[index] != numbers[index])
			{
				result = false;
				break;
			}
		}
	}
	return result;
}
开发者ID:Mmonya,项目名称:Monya_folder,代码行数:16,代码来源:BigInt.cpp

示例4: processResData

	// This function is given an entire block of the same residue. The rotamerIDs will of course be different.
	void processResData( const std::string& resName, ContainerType& data, RotamerLibrary& _RotLib, bool switchImportMode )
	{
		// Either there is something fundamental I don't understand, or ...
		// The dunbrack library has this really annoying thing whereby the 180 and -180 phi/psi torsions,
		// which are by definition the same thing, are both defined! 
		// We only want one, as both represent the same 10 degree bin!
		data.erase(std::remove_if(data.begin(),data.end(),removeParseData),data.end());

		if( switchImportMode )
		{
			processResData_ByRotID(resName,data,_RotLib);
		}
		else
		{
			data.erase(std::remove_if(data.begin(),data.end(),removeLowPropensity),data.end());
			processResData_ByChis(resName,data,_RotLib);
		}
	}
开发者ID:JonnyWideFoot,项目名称:pd,代码行数:19,代码来源:rotamer_dunbrack.cpp

示例5: processResData_ByChis

	void processResData_ByChis( const std::string& resName, ContainerType& data, RotamerLibrary& _RotLib )
	{
		const double tollerance = 12.0;

		// Ensure full chi arrays
		size_t largestSoFar = data[0].chis.size();
		for( size_t i = 1; i < data.size(); i++ )
		{
			if( data[i].chis.size() > largestSoFar )
			{
				largestSoFar = data[i].chis.size();
				i = 0; // reset
			}
			while( data[i].chis.size() < largestSoFar )
			{
				data[i].chis.push_back(0.0);
			}
		}

		size_t done = 0;
		std::vector<bool> taken(data.size());
		while( data.size() > done )
		{
			ContainerType subdata;
			bool on = false;
			for( int i = (int)data.size()-1; i >= 0; i-- )
			{
				if( taken[i] != true && (!on || equalChis( subdata[0], data[i], tollerance ) ) )
				{
					subdata.push_back( data[i] );
					taken[i] = true;
					on = true;
					done++;
				}
			}
			processData( resName, subdata, _RotLib, tollerance );
			subdata.clear();
		}
		data.clear();
	}
开发者ID:JonnyWideFoot,项目名称:pd,代码行数:40,代码来源:rotamer_dunbrack.cpp

示例6: specializedVisit

void WeakBlock::specializedVisit(ContainerType& container, SlotVisitor& visitor)
{
    HeapVersion markingVersion = visitor.markingVersion();

    size_t count = weakImplCount();
    for (size_t i = 0; i < count; ++i) {
        WeakImpl* weakImpl = &weakImpls()[i];
        if (weakImpl->state() != WeakImpl::Live)
            continue;

        WeakHandleOwner* weakHandleOwner = weakImpl->weakHandleOwner();
        if (!weakHandleOwner)
            continue;

        JSValue jsValue = weakImpl->jsValue();
        if (container.isMarkedConcurrently(markingVersion, jsValue.asCell()))
            continue;

        if (!weakHandleOwner->isReachableFromOpaqueRoots(Handle<Unknown>::wrapSlot(&const_cast<JSValue&>(jsValue)), weakImpl->context(), visitor))
            continue;

        visitor.appendUnbarriered(jsValue);
    }
}
开发者ID:mjparme,项目名称:openjdk-jfx,代码行数:24,代码来源:WeakBlock.cpp

示例7: checkContainerSame

inline bool checkContainerSame(const ContainerType & c1, const ContainerType & c2) {
	typename ContainerType::const_iterator it1 = c1.begin();
	typename ContainerType::const_iterator it2 = c2.begin();

	while(it1 != c1.end() && it2 != c2.end()) {
		if(*it1 != *it2) {
			return false;
		}

		++it1;
		++it2;
	}

	if(it1 != c1.end() || it1 != c1.end()) {
		return false;
	}

	return true;
}
开发者ID:Remscar,项目名称:cpgf,代码行数:19,代码来源:test_container.cpp

示例8: processResData_ByRotID

	void processResData_ByRotID( const std::string& resName, ContainerType& data, RotamerLibrary& _RotLib )
	{
		// Sort the data to increase efficiency below
		std::stable_sort( data.begin(), data.end(), sortPsi);
		std::stable_sort( data.begin(), data.end(), sortPhi);		
		std::stable_sort( data.begin(), data.end(), sortRotID);

		ContainerType subdata;
		
		while( true )
		{
			if( data.size() > 0 && (subdata.size() == 0 || subdata[0].rotID.compare( data.back().rotID,0,4,0 )) )
			{
				subdata.push_back( data.back() );
				data.erase(data.end()-1); // rob the end, not the start (ContainerType<> perfomance reasons!)
			}
			else
			{
				ASSERT( data.size() == (36*36), ParseException, "Assumption error!");
				ASSERT( data[0].phi == -180.0 && data[0].psi == -180.0, ParseException, "Wrong phi/psi");
				for( size_t j = 1; j < data.size(); j++ )
				{	
					ASSERT( data[j].phi == (-180.0+(j/36)*10) && data[j].psi == (-180.0+(j%36)*10), ParseException, "Wrong phi/psi");			
				}
				processData( resName, subdata, _RotLib, 40.0 ); // 40 degree tollerance delta from data[0]
				subdata.clear();
				if( data.size() == 0 )
				{
					return;
				}
			}
		}		
	}
开发者ID:JonnyWideFoot,项目名称:pd,代码行数:33,代码来源:rotamer_dunbrack.cpp

示例9: foreach

 void foreach( ContainerType & cont , Functor func )
 {
   std::for_each(cont.begin(),cont.end(),func);
 }
开发者ID:BackupTheBerlios,项目名称:callbackext,代码行数:4,代码来源:AlgorithmExt.hpp

示例10: foreach_reverse

 void foreach_reverse( ContainerType & cont , Functor func )
 {
   std::for_each(cont.rbegin(),cont.rend(),func);
 }
开发者ID:BackupTheBerlios,项目名称:callbackext,代码行数:4,代码来源:AlgorithmExt.hpp

示例11: operator

 void operator()(const ContainerType& new_bit) {
     for(typename ContainerType::const_iterator ci = new_bit.begin(); ci != new_bit.end(); ++ci) {
         my_result +=  *ci;
     }
 }
开发者ID:gomez-addams,项目名称:intel-tbb,代码行数:5,代码来源:test_combinable.cpp

示例12: mc

void DataTest::testColumnList()
{
	typedef std::list<int> ContainerType;
	typedef Column<ContainerType> ColumnType;

	MetaColumn mc(0, "mc", MetaColumn::FDT_DOUBLE, 2, 3, true);

	assert (mc.name() == "mc");
	assert (mc.position() == 0);
	assert (mc.length() == 2);
	assert (mc.precision() == 3);
	assert (mc.type() == MetaColumn::FDT_DOUBLE);
	assert (mc.isNullable());

	ContainerType* pData = new ContainerType;
	pData->push_back(1);
	pData->push_back(2);
	pData->push_back(3);
	pData->push_back(4);
	pData->push_back(5);
	
	ColumnType c(mc, pData);

	assert (c.rowCount() == 5);
	assert (c[0] == 1);
	assert (c[1] == 2);
	assert (c[2] == 3);
	assert (c[3] == 4);
	assert (c[4] == 5);
	assert (c.name() == "mc");
	assert (c.position() == 0);
	assert (c.length() == 2);
	assert (c.precision() == 3);
	assert (c.type() == MetaColumn::FDT_DOUBLE);

	try
	{
		int i; i = c[100]; // to silence gcc
		fail ("must fail");
	}
	catch (RangeException&) { }

	ColumnType c1 = c;

	assert (c1.rowCount() == 5);
	assert (c1[0] == 1);
	assert (c1[1] == 2);
	assert (c1[2] == 3);
	assert (c1[3] == 4);
	assert (c1[4] == 5);

	ColumnType c2(c1);
	assert (c2.rowCount() == 5);
	assert (c2[0] == 1);
	assert (c2[1] == 2);
	assert (c2[2] == 3);
	assert (c2[3] == 4);
	assert (c2[4] == 5);

	ContainerType vi;
	vi.assign(c.begin(), c.end());
	assert (vi.size() == 5);
	ContainerType::const_iterator it = vi.begin();
	ContainerType::const_iterator end = vi.end();
	for (int i = 1; it != end; ++it, ++i)
		assert (*it == i);

	c.reset();
	assert (c.rowCount() == 0);
	assert (c1.rowCount() == 0);
	assert (c2.rowCount() == 0);

	ContainerType* pV1 = new ContainerType;
	pV1->push_back(1);
	pV1->push_back(2);
	pV1->push_back(3);
	pV1->push_back(4);
	pV1->push_back(5);
	ContainerType* pV2 = new ContainerType;
	pV2->push_back(5);
	pV2->push_back(4);
	pV2->push_back(3);
	pV2->push_back(2);
	pV2->push_back(1);
	Column<ContainerType> c3(mc, pV1);
	Column<ContainerType> c4(mc, pV2);
	
	Poco::Data::swap(c3, c4);
	assert (c3[0] == 5);
	assert (c3[1] == 4);
	assert (c3[2] == 3);
	assert (c3[3] == 2);
	assert (c3[4] == 1);

	assert (c4[0] == 1);
	assert (c4[1] == 2);
	assert (c4[2] == 3);
	assert (c4[3] == 4);
	assert (c4[4] == 5);

//.........这里部分代码省略.........
开发者ID:carvalhomb,项目名称:tsmells,代码行数:101,代码来源:DataTest.cpp

示例13: ordered_adaptor_iterator

 ordered_adaptor_iterator(const ContainerType * container, ValueCompare const & cmp):
     container(container), current_index(container->size()),
     unvisited_nodes(compare_by_heap_value(container, ValueCompare()))
 {}
开发者ID:8573,项目名称:anura,代码行数:4,代码来源:ordered_adaptor_iterator.hpp

示例14: Q_ASSERT

QVariant QJson::parseObject(const QString &json, int &index, DecodeOptions options, bool &success, QString *errorMessage)
{
	Q_ASSERT(json[index] == '{');
	index++;
	skipWhitespace(json, index);

	ContainerType object;

	while (checkAvailable(json, index, success, errorMessage))
	{
		if (json[index] == QChar::fromLatin1('}'))
		{
			index++;
			return object;
		}
		else
		{
			QString key = QJson::parseValue(json, index, options, success, errorMessage).toString();
			if (!success)
				return QVariant();

			skipWhitespace(json, index);
			checkAvailable(json, index, success, errorMessage);

			if (json[index] == QChar::fromLatin1(':'))
				index++;
			else
			{
				success = false;
				if (errorMessage)
					*errorMessage = QString("Expected colon at position %1").arg(index);
				return QVariant();
			}

			skipWhitespace(json, index);

			QVariant value = QJson::parseValue(json, index, options, success, errorMessage);
			if (!success)
				return QVariant();

			// Add the key / value pair to the object
			object.insert(key, value);

			int skippedWhitespaces = skipWhitespace(json, index);
			checkAvailable(json, index, success, errorMessage);

			switch (json[index].toLatin1())
			{
			case ',':
				index++;
				skipWhitespace(json, index);
				break;

			case '}':
				//'}' will be processed in the next iteration
				break;

			default:
				// Only allow missing comma if there is at least one whitespace instead of the comma!
				if ((options & AllowMissingComma) && skippedWhitespaces > 0)
					break;
				else
				{
					success = false;
					if (errorMessage)
						*errorMessage = QString("Unexpected character at index %1").arg(index);
					return QVariant();
				}
			}
		}
	}

	return QVariant();
}
开发者ID:HoS0,项目名称:DesktopManager,代码行数:74,代码来源:qjson.cpp

示例15: array_view

 explicit array_view(ContainerType & container) noexcept
     : m_pointer{ container.data() }
     , m_size_in_items{ container.size() }
 { }
开发者ID:glampert,项目名称:array_view,代码行数:4,代码来源:array_view.hpp


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