本文整理汇总了C++中ContainerType::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ ContainerType::begin方法的具体用法?C++ ContainerType::begin怎么用?C++ ContainerType::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContainerType
的用法示例。
在下文中一共展示了ContainerType::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: calculate_residual_weights
/// Calculate residual weights for the next `robustifying` iteration.
void calculate_residual_weights(const size_t n,
const ContainerType& weights,
ContainerType& resid_weights)
{
ValueType r;
for (size_t i = 0; i < n; i++)
{
resid_weights[i] = std::abs(weights[i]);
}
// ***********************************
// Compute pseudo-median (take average even if we have an odd number of
// elements), following the original implementation. We could also use a
// true median calculation here:
// ValueType cmad = 6.0 * median(resid_weights.begin(), resid_weights.end());
// ***********************************
size_t m1 = n / 2; // FORTRAN starts with one, CPP with zero
// size_t m1 = 1 + n / 2; // original FORTRAN code
// size_t m2 = n - m1 + 1; // see below, we don't explicitly sort but use max_element
// Use nth element to find element m1, which produces a partially sorted
// vector. This means we can get element m2 by looking for the maximum in the
// remainder.
typename ContainerType::iterator it_m1 = resid_weights.begin() + m1;
std::nth_element(resid_weights.begin(), it_m1, resid_weights.end());
typename ContainerType::iterator it_m2 = std::max_element(
resid_weights.begin(), it_m1);
ValueType cmad = 3.0 * (*it_m1 + *it_m2);
ValueType c9 = .999 * cmad;
ValueType c1 = .001 * cmad;
for (size_t i = 0; i < n; i++)
{
r = std::abs(weights[i]);
if (r <= c1)
{
// near 0, avoid underflow
resid_weights[i] = 1.0;
}
else if (r > c9)
{
// near 1, avoid underflow
resid_weights[i] = 0.0;
}
else
{
resid_weights[i] = pow2(1.0 - pow2(r / cmad));
}
}
}
示例3: checkContainerIteratorIncrement
inline void checkContainerIteratorIncrement(ContainerType & container)
{
typename ContainerType::iterator it;
it = container.begin();
//__asm int 3;
it++;
++it;
if(it == container.end()) {
it = container.begin();
}
}
示例4: append
void append(ContainerType* pContainer, const ContainerType& other)
{
pContainer->insert(
pContainer->end(),
other.begin(),
other.end());
}
示例5: SetIntersect
void AlignmentElement::SetIntersect(const AlignmentElement &otherElement)
{
ContainerType newElement;
set_intersection(m_collection.begin() , m_collection.end()
,otherElement.begin() , otherElement.end()
,inserter(newElement , newElement.begin()) );
m_collection = newElement;
}
示例6: clearCointainerOfPointers
inline void clearCointainerOfPointers(ContainerType& container_) {
typename ContainerType::iterator it = container_.begin();
while (it != container_.end()) {
delete *it;
++it;
}
container_.clear();
}
示例7: evalRPN
void evalRPN(ContainerType& sVec){
stack <string> numbers;
int op1,op2;
strVecIter sIter = sVec.begin();
while (sIter != sVec.end()){
if (isInteger(*sIter)){
//cout << *sIter <<" is integer" << endl;
numbers.push(*sIter);
}
else {
switch (whichOp(*sIter ))
{
case 1:
//cout << "+ operand" << endl;
op1=atoi( numbers.top().c_str() );
numbers.pop();
op2=atoi( numbers.top().c_str() );
numbers.pop();
numbers.push( to_string(op2 + op1));
break;
case 2:
//cout << "- operand" << endl;
op1=atoi( numbers.top().c_str() );
numbers.pop();
op2=atoi( numbers.top().c_str() );
numbers.pop();
numbers.push( to_string(op2 - op1));
break;
case 3:
//cout << "* operand" << endl;
op1=atoi( numbers.top().c_str() );
numbers.pop();
op2=atoi( numbers.top().c_str() );
numbers.pop();
numbers.push( to_string(op2 * op1));
break;
case 4:
//cout << "/ operand" << endl;
op1=atoi( numbers.top().c_str() );
numbers.pop();
op2=atoi( numbers.top().c_str() );
numbers.pop();
numbers.push( to_string(op2 / op1));
break;
default:
cout << "ERROR";
break;
}
}
sIter++;
}
while (numbers.size()>0){
cout << numbers.top() << " " << endl;
numbers.pop();
}
}
示例8: FromContainer
void FromContainer(const ContainerType &in_container,
const char *name_string = NULL) {
typename ContainerType::const_iterator iter_b(in_container.begin());
typename ContainerType::const_iterator iter_e(in_container.end());
while (iter_b != iter_e) {
Append(iter_b->c_str(), name_string);
++iter_b;
}
}
示例9: TEST_OutputContainer
static void TEST_OutputContainer(const char *container_name,
const ContainerType &the_cont)
{
std::cout << container_name << std::endl;
std::cout << std::string(10, '-') << std::endl;
std::copy(the_cont.begin(), the_cont.end(),
std::ostream_iterator<ContainerType::value_type>(std::cout, "\n"));
std::cout << std::string(10, '-') << std::endl;
}
示例10: TEST_EmitList
void TEST_EmitList(const ContainerType &data_list)
{
ContainerType::const_iterator iter_b(data_list.begin());
ContainerType::const_iterator iter_e(data_list.end());
for ( ; iter_b != iter_e; ++iter_b)
std::cout
<< iter_b->ToStringTest() << std::endl;
}
示例11: 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);
}
}
示例12: extractConfigOptionListImpl
inline TyErrorId
extractConfigOptionList(
const AnnotatorContext& crclConfig,
const ConfigOptionInfo::StOptionInfo& crclOptionInfo,
ContainerType& rclTargetContainer
) {
return extractConfigOptionListImpl(crclConfig, crclOptionInfo, rclTargetContainer,
STL_ITER2PTR(rclTargetContainer.begin()));
}
示例13: 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;
}
示例14: checkInOrder
inline void checkInOrder(ContainerType & c, CompareType compare) {
typedef typename ContainerType::iterator IteratorType;
IteratorType it;
for(it = c.begin(); it != c.end(); ++it) {
IteratorType itNext = it;
++itNext;
if(itNext != c.end()) {
GCHECK(compare(*it, *itNext));
}
}
}
示例15: show_elements
void show_elements( ContainerType& cont, const string& prefix )
{
cout << prefix << " : ";
typename ContainerType::const_iterator iter = cont.begin();
typename ContainerType::const_iterator end = cont.end();
while( iter != end )
{
cout << *iter << " ";
++iter;
}
cout << endl;
}