map - Issue with C++ B-tree -


I am using it and I have an issue that someone might be able to answer.

First of all, I receive the following error: Prefix in the file that is included in ref_impl /../ / btree_map.h: 31: 0, from ref_impl / core.cpp : 48: ref_impl /../ Btree.h: btree :: btree_node & lt; Parameter & gt; :: Reference btree :: btree_node & lt; Ultimate & gt; :: value (int) immediately [params = btri :: bti_map_param and lieutenant; Unsigned int, unsigned int, std :: low & lt; Unsigned int & gt; std :: allocation & lt; Std :: pair & lt; Const unsigned int, unsigned int & gt; & Gt; 256 & gt; Btree :: btree_node & lt; Ultimate & gt; :: reference = std :: pair & lt; Const unsigned int, unsigned int & gt; & Amp;] ?????: ref_impl /../ included / btree.h: 809: 33: Required node, reference, indicator & gt; :: Indicator BT :: btree_iterator & lt; Node, context, indicator & gt; :: operator- & gt; () CONST [node = BTR :: BTI_Node & lt; Btree :: with] btree :: btree_iterator & lt; Btree_map_params & lt; Unsigned int, unsigned int, std :: low & lt; Unsigned int & gt; std :: olocator & lt; Std :: pair & lt; Const unsigned int, unsigned int & gt; & Gt; 256 & gt; & Gt ;; Context = std :: pair & lt; Const unsigned int, unsigned int & gt; Pointer = std :: pair & lt; Const unsigned int, unsigned int & gt; *; Btree :: btree_iterator & lt; Node, context, indicator & gt; :: indicator = std :: pair & lt; Const unsigned int, unsigned int & gt; *] One ???? Ref_impl / core.cpp: 539: 18: Requires ref_impl /../ from here / btree.h: 557: 57: Warning: Dereferencing type-punned pointer will break the strict-aliasing rule [-Validate-aliasing] < / Code>

btree.h:

  Pointer operator-> () const {returns and node-> Value (status); }   

This seems to be the cause of the error.

One part of my code is the following:

  auto category = duplicates.equal_range (query_ids_temp [i]); (Auto = this category. First; it! = Range.second; ++ it) {// error std :: vector & lt; Unsigned int & gt; :: iterator pos = std :: find (deleted_queries.begin (), deleted_queries) end (), it-> second); // Error if (pos! = Deleted_queries.end ()) {duplicates.erase (this); Deleted_queries.erase (POS); } And {query_ids.push_back (it-> second); }}   

The error seems like - gt; Second

In addition to this I tried:

 for  (btree_multimap & lt; unsigned int, unsigned interval; gt; :: iterator = class.first; it! = Range.second; ++ it) {// error auto temp = it-> second; // error std :: vector & lt; Unsigned int & gt; :: iterator position = std :: find (deleted_queries.begin (), deleted_queries.end (), temp); If (status! = Deleted_queries.end ()) {duplicates.erase (temp); Deleted_queries.erase (status); } And {query_ids.push_back (it-> second); }}   

Please keep in mind that the error is automatically temp = it- & gt; second;

I have also tried:

  auto p = duplicates.find (query_ids_temp [i]); Found a name in if (p! = Duplicates.end ()) {// {// error auto temp = p-> second; // Error auto status = std :: find (deleted_queries.begin (), deleted_queries.end (), temp); If (pos! = Deleted_queries.end ()) {duplicates.erase (p-> seconds); Deleted_queries.erase (POS); } And {query_ids.push_back (p-> second); } P ++; } While (p! = Duplicate.parapound (query_ids_temp [i])); } And {cout & lt; & Lt; "The name was not found. \ N"; }   

And the problem looks the same again: auto temp = p-> second;

Any suggestions?

The central warning with Google's B-tree is that duplicate within the loop to make the mutation ineligible. () Invalidates the call "p".

Erase () method gives an iterator for this reason, so that you can write something like this:

  if (...) {p = duplicate.rase (...); ...} and {... p ++; }   

BTW, please provide the details of which compiler version has warned.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -