CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2015
    Posts
    500

    help with the following code

    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

  2. #2
    Join Date
    May 2015
    Posts
    500

    Re: help with the following code

    Moved to top of forloop works ok..thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured