本文整理汇总了C++中ContainerType::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ ContainerType::clear方法的具体用法?C++ ContainerType::clear怎么用?C++ ContainerType::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContainerType
的用法示例。
在下文中一共展示了ContainerType::clear方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
}
}
示例2: clearCointainerOfPointers
inline void clearCointainerOfPointers(ContainerType& container_) {
typename ContainerType::iterator it = container_.begin();
while (it != container_.end()) {
delete *it;
++it;
}
container_.clear();
}
示例3: 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();
}
示例4: CharPtrArrayToStringContainer
void CharPtrArrayToStringContainer(unsigned int in_count,
char **in_list, ContainerType &container, const char *name_string = NULL)
{
container.clear();
C_ListTypeString<unsigned int> tmp_list;
// Force it to look like a 'C_ListTypeString'...
tmp_list.SetCount(in_count);
tmp_list.SetList(in_list);
// Put the list into the container...
tmp_list.ToContainer(container, name_string);
// Mustn't try to free when we leave this scope...
tmp_list.Reset();
}
示例5: 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;
}
}
}
}
}
示例6: clear
void clear()
{
_buffer.clear();
}