本文整理汇总了C++中std::unordered_multimap::equal_range方法的典型用法代码示例。如果您正苦于以下问题:C++ unordered_multimap::equal_range方法的具体用法?C++ unordered_multimap::equal_range怎么用?C++ unordered_multimap::equal_range使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::unordered_multimap
的用法示例。
在下文中一共展示了unordered_multimap::equal_range方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PreFullReleaseModel
void PreFullReleaseModel(int streamingIdx)
{
int drawblDict = *(int*)0xF272E4;
if (streamingIdx >= GetTypeStart(drawblDict) && streamingIdx <= GetTypeEnd(drawblDict))
{
int dict = streamingIdx - GetTypeStart(drawblDict);
auto pair = m_dependencyDrawableDicts.equal_range(dict);
for (auto it = pair.first; it != pair.second; it++)
{
if (it->second->HasInstance())
{
//trace("releasing dict %s (0x%08x) for a full release because *reasons*\n", GetStreamName(dict, *(int*)0xF272E4).c_str(), it->second->GetModelHash());
it->second->RemoveInstance();
}
}
//m_dependencyDrawableDicts.erase(dict);
auto entPair = m_dependencyDictEnts.equal_range(dict);
for (auto it = entPair.first; it != entPair.second; it++)
{
//trace("also destroying model for dict %s\n", GetStreamName(dict, *(int*)0xF272E4).c_str());
it->second->DestroyModel();
}
m_dependencyDictEnts.erase(dict);
}
}
示例2: DrawableDictStoreGetUsageWrap
int DrawableDictStoreGetUsageWrap(int dict)
{
int usage = DrawblDictGetUsage(dict);
if (usage == 0 && _ReturnAddress() == (void*)0xBCC153)
{
bool deferred = false;
auto pair = m_dependencyDrawableDicts.equal_range(dict);
for (auto it = pair.first; it != pair.second; it++)
{
if (it->second->HasInstance())
{
if (!it->second->ShouldRelease())
{
//trace("model info for %s (0x%08x) still has %i references!\n", GetStreamName(dict, *(int*)0xF272E4).c_str(), it->second->GetModelHash(), it->second->GetRefCount());
return 1;
}
it->second->RemoveInstance();
deferred = true;
}
}
//m_dependencyDrawableDicts.erase(dict);
auto entPair = m_dependencyDictEnts.equal_range(dict);
for (auto it = entPair.first; it != entPair.second; it++)
{
it->second->DestroyModel();
deferred = true;
}
m_dependencyDictEnts.erase(dict);
if (deferred)
{
//trace("pre-deferring drawable destruction for %s\n", GetStreamName(dict, *(int*)0xF272E4).c_str());
DeferToNextFrame([=] ()
{
//trace("executing pre-deferred drawable destruction for %s\n", GetStreamName(dict, *(int*)0xF272E4).c_str());
//ReleaseDrawblDict(dict);
ReleaseStreamingObjectNow((void*)0xF21C60, dict + GetTypeStart(*(int*)0xF272E4));
});
return 1;
}
}
return usage;
}
示例3: strIsInHashTable
bool strIsInHashTable(RawString &str, std::hash<std::string> &strHash,
std::unordered_multimap<u32, StringTableNode> &stringTable)
{
u32 hash = strHash(str);
int numMatching = stringTable.count(hash);
if ( numMatching == 1 )
{ // Should guarentee that you can find at least one entry
StringTableNode &node = stringTable.find(hash)->second;
if ( node.string.compare(str) == 0 )
return true;
}
else if ( numMatching > 1 )
{
u32 currLowest = 0;
bool success = false;
auto range = stringTable.equal_range(hash);
for ( auto it = range.first; it != range.second; it ++ )
{
StringTableNode &node = it->second;
if ( node.string.compare(str) == 0 )
{
if ( success == false ) // If no matches have previously been found
{
currLowest = node.stringNum;
success = true;
}
else if ( node.stringNum < currLowest ) // If matches have previously been found
currLowest = node.stringNum; // Replace if stringNum < previous stringNum
}
}
return success;
}
return false; // No matches
}
示例4: get
std::vector<POINTER> get( ID id ) const
{
std::vector<POINTER> result ;
auto pair = components.equal_range(id) ;
for( auto iter = pair.first ; iter != pair.second ; ++iter ) result.push_back(iter->second) ;
return result ;
}
示例5: get_keypoint_strokes
PyArrayObject* get_keypoint_strokes(int keypointId, int instance)
{
if(keypointsPixels.size() > 0)
{
std::pair <std::unordered_multimap<int,std::pair<int, int> >::iterator, std::unordered_multimap<int,std::pair<int, int>>::iterator> ret;
ret = keypointsPixels.equal_range(keypoints[keypointId].class_id);
npy_intp size_pts[2];
size_pts[0] = std::distance(ret.first, ret.second);
size_pts[1] = 2;
PyArrayObject* out = (PyArrayObject *) PyArray_SimpleNew( 2, size_pts, NPY_OBJECT );
int strokesCount = 0;
for (std::unordered_multimap<int,std::pair<int, int> >::iterator it=ret.first; it!=ret.second; it++)
{
char* ptr = (char*) PyArray_GETPTR2(out, strokesCount, 0);
PyArray_SETITEM(out, ptr, PyInt_FromLong(it->second.first));
ptr = (char*) PyArray_GETPTR2(out, strokesCount, 1);
PyArray_SETITEM(out, ptr, PyInt_FromLong(it->second.second));
strokesCount++;
}
return out;
}
std::vector<std::vector<cv::Ptr<StrokeDir> > >& strokes = instances[instance].segmenter->keypointStrokes[keypointId];
npy_intp size_pts[2];
int strokesCount = 0;
for( size_t i = 0; i < strokes.size(); i++ )
{
strokesCount += strokes[i].size();
}
size_pts[0] = strokesCount;
size_pts[1] = 4;
PyArrayObject* out = (PyArrayObject *) PyArray_SimpleNew( 2, size_pts, NPY_OBJECT );
strokesCount = 0;
for( size_t i = 0; i < strokes.size(); i++ )
{
for( size_t j = 0; j < strokes[i].size(); j++ )
{
char* ptr = (char*) PyArray_GETPTR2(out, strokesCount, 0);
PyArray_SETITEM(out, ptr, PyInt_FromLong(strokes[i][j]->center.x));
ptr = (char*) PyArray_GETPTR2(out, strokesCount, 1);
PyArray_SETITEM(out, ptr, PyInt_FromLong(strokes[i][j]->center.y));
ptr = (char*) PyArray_GETPTR2(out, strokesCount, 2);
PyArray_SETITEM(out, ptr, PyInt_FromLong(strokes[i][j]->direction.x));
ptr = (char*) PyArray_GETPTR2(out, strokesCount, 3);
PyArray_SETITEM(out, ptr, PyInt_FromLong(strokes[i][j]->direction.y));
strokesCount++;
}
}
return out;
}
示例6: calDeltaBRec
//store every state-network node's B in "TF_B"
int calDeltaBRec(std::unordered_multimap<int,std::pair<int,int>> &SN,int start,double *TF_B)
{
int b = 1,temp;
auto its = SN.equal_range(start);
for (auto it = its.first; it != its.second; ++it)
if(it->first != it->second.first){
temp = calDeltaBRec(SN,it->second.first,TF_B);
b += temp;
}
TF_B[start] = b;
return b;
}
示例7: calBRec
//calculate B recursion function
int calBRec(std::unordered_multimap<int,std::pair<int,int>> &SN,int start)
{
int b = 1,temp;
auto its = SN.equal_range(start);
for (auto it = its.first; it != its.second; ++it)
if(it->first != it->second.first){
temp = calBRec(SN,it->second.first);
b += temp;
it->second.second = temp;//traffic flow
}
return b;
}
示例8: calDeltaDRec
//store every state-network node's D in "TF_D"
int calDeltaDRec(std::unordered_multimap<int,std::pair<int,int>> &SN,int start,double *TF_D)
{
int d = 0,temp;
auto its = SN.equal_range(start);
for (auto it = its.first; it != its.second; ++it)
if(it->first != it->second.first){
temp = calDeltaDRec(SN,it->second.first,TF_D);
d += 1;
it->second.second = temp;//traffic flow
}
TF_D[start] = d;
return d;
}
示例9: calWRec
//calculate the <Wn>,and store the W for each attractor
double calWRec(std::unordered_multimap<int,std::pair<int,int>> &SN,int start,int L,int total_trafic)
{
int total_traffic2;
double w = 0;
auto its = SN.equal_range(start);
for (auto it = its.first; it != its.second; ++it)
if(it->first != it->second.first){
total_traffic2 = total_trafic + it->second.second; //total traffic flow from it->second.second to the attractor
w += (double)total_traffic2/L + calWRec(SN,it->second.first,L+1,total_traffic2);
}
//store the traffic flow!!!!this is not traffic flow!!!!!
//TF[start] = w;
return w;
}
示例10: findMaxBRec
//find maximum B recursion function
int findMaxBRec(std::unordered_multimap<int,std::pair<int,int>> &SN,int start,double *TF)
{
int b = 1,temp;
//int b = 0,temp;
auto its = SN.equal_range(start);
for (auto it = its.first; it != its.second; ++it)
if(it->first != it->second.first){
temp = findMaxBRec(SN,it->second.first,TF);
b += temp;
//findMaxBRec(SN,it->second.first,TF);
//b += 1;
it->second.second = temp;//traffic flow
}
TF[start] = b;
return b;
}
示例11: _recurse
size_t Relationships::_recurse(size_t src) {
Person *dst;
size_t height = 0;
std::cerr << "visiting " << src << std::endl;
for (auto pair = _edges.equal_range(src)
; pair.first != pair.second
; pair.first++) {
dst = &_vertices[pair.first->second];
if (!dst->visited)
height = std::max(height, _recurse(pair.first->second));
else
height = std::max(height, dst->furthest_influencer);
}
_vertices[src].furthest_influencer = height + 1;
_vertices[src].visited = true;
std::cerr << "visiting " << src << "#DONE got: " << height + 1 << std::endl;
return height + 1;
}
示例12: exclude_referenced_bridgee
void exclude_referenced_bridgee(DexMethod* code_method, const DexCode& code) {
auto const& insts = code.get_instructions();
for (auto inst : insts) {
if (!is_invoke(inst->opcode())) continue;
auto method = static_cast<DexOpcodeMethod*>(inst)->get_method();
auto range = m_potential_bridgee_refs.equal_range(
MethodRef(method->get_class(), method->get_name(),
method->get_proto()));
for (auto it = range.first; it != range.second; ++it) {
auto referenced_bridge = it->second;
// Don't count the bridge itself
if (referenced_bridge == code_method) continue;
TRACE(BRIDGE,
5,
"Rejecting, reference `%s.%s.%s' in `%s' blocks `%s'\n",
SHOW(method->get_class()),
SHOW(method->get_name()),
SHOW(method->get_proto()),
SHOW(code_method),
SHOW(referenced_bridge));
m_bridges_to_bridgees.erase(referenced_bridge);
}
}
}
示例13: exclude_referenced_bridgee
void exclude_referenced_bridgee(DexMethod* code_method, IRCode& code) {
for (auto& mie : InstructionIterable(&code)) {
auto inst = mie.insn;
if (!is_invoke(inst->opcode())) continue;
auto method = inst->get_method();
auto range = m_potential_bridgee_refs.equal_range(
MethodRef(method->get_class(), method->get_name(),
method->get_proto()));
for (auto it = range.first; it != range.second; ++it) {
auto referenced_bridge = it->second;
// Don't count the bridge itself
if (referenced_bridge == code_method) continue;
TRACE(BRIDGE,
5,
"Rejecting, reference `%s.%s.%s' in `%s' blocks `%s'\n",
SHOW(method->get_class()),
SHOW(method->get_name()),
SHOW(method->get_proto()),
SHOW(code_method),
SHOW(referenced_bridge));
m_bridges_to_bridgees.erase(referenced_bridge);
}
}
}