Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3027

help with the following code

$
0
0
Hello,

Code:

                                        std::map<int, std::multiset<TACNeighbourData> >::iterator found = m_SiteKeyToNeighbourKeys.find(nTopParentKey);

                                        for (auto sneigh : sNeighbourKeys)
                                        {
                                                if (found != m_SiteKeyToNeighbourKeys.end())
                                                {
                                                        // Also check if this cell id is already listed
                                                        std::multiset<TACNeighbourData>::iterator result =
                                                                std::find_if(found->second.begin(), found->second.end(), find_by_cellkey(sneigh.m_CellKey));

                                                        if (result == found->second.end())
                                                        {
                                                                // no match
                                                                found->second.insert(sneigh);
                                                        }

                                                }
                                                else
                                                {
                                                        std::multiset<TACNeighbourData> temp;
                                                        temp.insert(sneigh);
                                                        m_SiteKeyToNeighbourKeys.insert(make_pair(nTopParentKey, temp));
                                                }

                                                auto found = m_SiteKeyToNeighbourKeys.find(nTopParentKey);
                                        }

Initially for the first neighbour the m_SiteKeyToNeighbourKeys gets created as found ==end().

But for the next loop also it is getting end().
Could you please kindly help

Viewing all articles
Browse latest Browse all 3027