本文整理汇总了C++中std::unordered_multimap::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ unordered_multimap::begin方法的具体用法?C++ unordered_multimap::begin怎么用?C++ unordered_multimap::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::unordered_multimap
的用法示例。
在下文中一共展示了unordered_multimap::begin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrettyPrint
inline std::string PrettyPrint(const std::unordered_multimap<A, B, Hash, Predicate, Allocator>& maptoprint, const bool add_delimiters=false, const std::string& separator=", ")
{
std::ostringstream strm;
if (maptoprint.size() > 0)
{
if (add_delimiters)
{
strm << "{";
typename std::unordered_multimap<A, B, Hash, Predicate, Allocator>::const_iterator itr;
for (itr = maptoprint.begin(); itr != maptoprint.end(); ++itr)
{
std::pair<A, B> cur_pair(itr->first, itr->second);
if (itr != maptoprint.begin())
{
strm << separator << PrettyPrint(cur_pair, add_delimiters, separator);
}
else
{
strm << PrettyPrint(cur_pair, add_delimiters, separator);
}
}
strm << "}";
}
else
{
typename std::unordered_multimap<A, B, Hash, Predicate, Allocator>::const_iterator itr;
for (itr = maptoprint.begin(); itr != maptoprint.end(); ++itr)
{
std::pair<A, B> cur_pair(itr->first, itr->second);
if (itr != maptoprint.begin())
{
strm << separator << PrettyPrint(cur_pair, add_delimiters, separator);
}
else
{
strm << PrettyPrint(cur_pair, add_delimiters, separator);
}
}
}
}
return strm.str();
}
示例2: f_unordered_multimap
void f_unordered_multimap() {
std::unordered_multimap<int, int> C;
std::unordered_multimap<int, int>::iterator UMMapI1 = C.begin();
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when declaring iterators
// CHECK-FIXES: auto UMMapI1 = C.begin();
const std::unordered_multimap<int, int> D;
std::unordered_multimap<int, int>::const_iterator UMMapI2 = D.begin();
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when declaring iterators
// CHECK-FIXES: auto UMMapI2 = D.begin();
}
示例3: make_pair
//calculate the given dynamical-network's maxminum B and its corresponding w
std::pair<int,double> calmaxBW(std::unordered_multimap<int,std::pair<int,int>> &SN)
{
int maxB = 0,temp,attractor = 0;
double Wn;
for(auto it = SN.begin(); it != SN.end(); it++){
if(it->first == it->second.first){
temp = calBRec(SN,it->second.first);
if(temp > maxB){
maxB = temp;
attractor = it->first;//main attractor
}
}
}
Wn = calWRec(SN,attractor,1,0);
return std::make_pair(maxB,Wn/maxB);
}
示例4: make_pair
//find the maximum B:basin for a given directed network
std::pair<int,double> findMaxBW(std::unordered_multimap<int,std::pair<int,int>> &SN,double *TF)
{
int maxB = 0,temp,attractor = 0;
double Wn;
for(auto it = SN.begin(); it != SN.end(); it++){
/**!!!!!!!!!!!your must change attractor!!!!!!!!**/
if(it->first == it->second.first && it->first == 76){
temp = findMaxBRec(SN,it->second.first,TF);
if(temp > maxB){
maxB = temp;
attractor = it->first;//main attractor
}
}
}
Wn = calWRec(SN,attractor,1,0);
return std::make_pair(maxB,Wn/maxB);
}
示例5: operator
void operator()(msgpack::object::with_zone& o, const std::unordered_multimap<K, V, Hash, Compare, Alloc>& v) const {
o.type = msgpack::type::MAP;
if(v.empty()) {
o.via.map.ptr = nullptr;
o.via.map.size = 0;
} else {
uint32_t size = checked_get_container_size(v.size());
msgpack::object_kv* p = static_cast<msgpack::object_kv*>(o.zone.allocate_align(sizeof(msgpack::object_kv)*size));
msgpack::object_kv* const pend = p + size;
o.via.map.ptr = p;
o.via.map.size = size;
typename std::unordered_multimap<K, V, Hash, Compare, Alloc>::const_iterator it(v.begin());
do {
p->key = msgpack::object(it->first, o.zone);
p->val = msgpack::object(it->second, o.zone);
++p;
++it;
} while(p < pend);
}
}