Right way to remove an element in std::setWhat's the best way to trim std::string?What is the easiest way to initialize a std::vector with hardcoded elements?RGBApixel memory issue with EasyBMP c++pointer being freed was not allocated for pointer assignmenthow to delete myself with referencexcode cocos2d arc multiple errors(C++ Error: pointer being freed was not allocated) for linked listsC++ memory allocation error“Pointer being freed not allocated error”Run time memory allocation error

Why would an invisible personal shield be necessary?

Can I attune a Circlet of Human Perfection to my animated skeletons to allow them to blend in and speak?

What would the United Kingdom's "optimal" Brexit deal look like?

Wrapping IMemoryCache with SemaphoreSlim

How to season a character?

Is The Venice Syndrome documentary cover photo real?

Why did House of Representatives need to condemn Trumps Tweets?

Why did Windows 95 crash the whole system but newer Windows only crashed programs?

How did astronauts using rovers tell direction without compasses on the Moon?

Why put copper in between battery contacts and clamps?

Why does Canada require bilingualism in a lot of federal government posts?

My employer is refusing to give me the pay that was advertised after an internal job move

How should I quote American English speakers in a British English essay?

If the Moon were impacted by a suitably sized meteor, how long would it take to impact the Earth?

Is SecureRandom.ints() secure?

Antonym of "Megalomania"

What Marvel character has this 'W' symbol?

A variant of the Multiple Traveling Salesman Problem

What are the cons of stateless password generators?

How does a poisoned arrow combine with the spell Conjure Barrage?

Who said "one can be a powerful king with a very small sceptre"?

Convert graph format for Mathematica graph functions

Is it okay for me to decline a project on ethical grounds?

Alternatives to minimizing loss in regression



Right way to remove an element in std::set


What's the best way to trim std::string?What is the easiest way to initialize a std::vector with hardcoded elements?RGBApixel memory issue with EasyBMP c++pointer being freed was not allocated for pointer assignmenthow to delete myself with referencexcode cocos2d arc multiple errors(C++ Error: pointer being freed was not allocated) for linked listsC++ memory allocation error“Pointer being freed not allocated error”Run time memory allocation error






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








-3















I have a graph class



struct Graph

list<Node *> vertices;
;


int main()

Graph g;
// fill out graph

return 0;



I want to perform a Dijkstra-shortest-path-like algorithm. Step 1 would be creating a set out of all the nodes, which I accomplish by



set<Node *> outstanding;
for (auto itx=g.vertices.begin(); itx!=g.vertices.end(); itx++)

outstanding.insert(*itx);



Step 2 would be to extract the vertex with a certain property



 double max_height_comp = (*(g.vertices.begin()))->max_height;
set<Node *>::const_iterator it_max;
while (!outstanding.empty())
{
for (auto its=outstanding.begin(); its!=outstanding.end(); its++)

if ((*its)->max_height >= max_height_comp)

max_height_comp = (*its)->max_height;
it_max = its;


outstanding.erase(it_max);


I'm getting these runtime errors



malloc: *** error for object 0x7fc485c02de0: pointer being freed was not allocated 
malloc: *** set a breakpoint in malloc_error_break to debug


I fear that erase() is calling free() or delete on the elements of outstanding which are pointers. But why would it do that? I just want to delete the value of the pointer from the set, I don't want to delete the data that the pointer is pointing to.










share|improve this question





















  • 2





    I suspect you're erasing an iterator to the same node twice. Can you show the code where you initialise it_max and max_height_comp between erases?

    – Peter Bell
    Mar 26 at 20:44











  • @PeterBell Thanks for the comment. I edited the post.

    – ToniAz
    Mar 26 at 20:48











  • So let's break this down. All your loop does is erase the maximum item in the set that is greater than or equal to (*(g.vertices.begin()))->max_height;? Is that correct? If so, this does not require a for loop. The max item can be obtained using std::max_element and compare against max_height. If so, erase that iterator.

    – PaulMcKenzie
    Mar 26 at 20:59


















-3















I have a graph class



struct Graph

list<Node *> vertices;
;


int main()

Graph g;
// fill out graph

return 0;



I want to perform a Dijkstra-shortest-path-like algorithm. Step 1 would be creating a set out of all the nodes, which I accomplish by



set<Node *> outstanding;
for (auto itx=g.vertices.begin(); itx!=g.vertices.end(); itx++)

outstanding.insert(*itx);



Step 2 would be to extract the vertex with a certain property



 double max_height_comp = (*(g.vertices.begin()))->max_height;
set<Node *>::const_iterator it_max;
while (!outstanding.empty())
{
for (auto its=outstanding.begin(); its!=outstanding.end(); its++)

if ((*its)->max_height >= max_height_comp)

max_height_comp = (*its)->max_height;
it_max = its;


outstanding.erase(it_max);


I'm getting these runtime errors



malloc: *** error for object 0x7fc485c02de0: pointer being freed was not allocated 
malloc: *** set a breakpoint in malloc_error_break to debug


I fear that erase() is calling free() or delete on the elements of outstanding which are pointers. But why would it do that? I just want to delete the value of the pointer from the set, I don't want to delete the data that the pointer is pointing to.










share|improve this question





















  • 2





    I suspect you're erasing an iterator to the same node twice. Can you show the code where you initialise it_max and max_height_comp between erases?

    – Peter Bell
    Mar 26 at 20:44











  • @PeterBell Thanks for the comment. I edited the post.

    – ToniAz
    Mar 26 at 20:48











  • So let's break this down. All your loop does is erase the maximum item in the set that is greater than or equal to (*(g.vertices.begin()))->max_height;? Is that correct? If so, this does not require a for loop. The max item can be obtained using std::max_element and compare against max_height. If so, erase that iterator.

    – PaulMcKenzie
    Mar 26 at 20:59














-3












-3








-3








I have a graph class



struct Graph

list<Node *> vertices;
;


int main()

Graph g;
// fill out graph

return 0;



I want to perform a Dijkstra-shortest-path-like algorithm. Step 1 would be creating a set out of all the nodes, which I accomplish by



set<Node *> outstanding;
for (auto itx=g.vertices.begin(); itx!=g.vertices.end(); itx++)

outstanding.insert(*itx);



Step 2 would be to extract the vertex with a certain property



 double max_height_comp = (*(g.vertices.begin()))->max_height;
set<Node *>::const_iterator it_max;
while (!outstanding.empty())
{
for (auto its=outstanding.begin(); its!=outstanding.end(); its++)

if ((*its)->max_height >= max_height_comp)

max_height_comp = (*its)->max_height;
it_max = its;


outstanding.erase(it_max);


I'm getting these runtime errors



malloc: *** error for object 0x7fc485c02de0: pointer being freed was not allocated 
malloc: *** set a breakpoint in malloc_error_break to debug


I fear that erase() is calling free() or delete on the elements of outstanding which are pointers. But why would it do that? I just want to delete the value of the pointer from the set, I don't want to delete the data that the pointer is pointing to.










share|improve this question
















I have a graph class



struct Graph

list<Node *> vertices;
;


int main()

Graph g;
// fill out graph

return 0;



I want to perform a Dijkstra-shortest-path-like algorithm. Step 1 would be creating a set out of all the nodes, which I accomplish by



set<Node *> outstanding;
for (auto itx=g.vertices.begin(); itx!=g.vertices.end(); itx++)

outstanding.insert(*itx);



Step 2 would be to extract the vertex with a certain property



 double max_height_comp = (*(g.vertices.begin()))->max_height;
set<Node *>::const_iterator it_max;
while (!outstanding.empty())
{
for (auto its=outstanding.begin(); its!=outstanding.end(); its++)

if ((*its)->max_height >= max_height_comp)

max_height_comp = (*its)->max_height;
it_max = its;


outstanding.erase(it_max);


I'm getting these runtime errors



malloc: *** error for object 0x7fc485c02de0: pointer being freed was not allocated 
malloc: *** set a breakpoint in malloc_error_break to debug


I fear that erase() is calling free() or delete on the elements of outstanding which are pointers. But why would it do that? I just want to delete the value of the pointer from the set, I don't want to delete the data that the pointer is pointing to.







c++ pointers malloc stdset






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 20:46







ToniAz

















asked Mar 26 at 20:41









ToniAzToniAz

1273 silver badges14 bronze badges




1273 silver badges14 bronze badges










  • 2





    I suspect you're erasing an iterator to the same node twice. Can you show the code where you initialise it_max and max_height_comp between erases?

    – Peter Bell
    Mar 26 at 20:44











  • @PeterBell Thanks for the comment. I edited the post.

    – ToniAz
    Mar 26 at 20:48











  • So let's break this down. All your loop does is erase the maximum item in the set that is greater than or equal to (*(g.vertices.begin()))->max_height;? Is that correct? If so, this does not require a for loop. The max item can be obtained using std::max_element and compare against max_height. If so, erase that iterator.

    – PaulMcKenzie
    Mar 26 at 20:59













  • 2





    I suspect you're erasing an iterator to the same node twice. Can you show the code where you initialise it_max and max_height_comp between erases?

    – Peter Bell
    Mar 26 at 20:44











  • @PeterBell Thanks for the comment. I edited the post.

    – ToniAz
    Mar 26 at 20:48











  • So let's break this down. All your loop does is erase the maximum item in the set that is greater than or equal to (*(g.vertices.begin()))->max_height;? Is that correct? If so, this does not require a for loop. The max item can be obtained using std::max_element and compare against max_height. If so, erase that iterator.

    – PaulMcKenzie
    Mar 26 at 20:59








2




2





I suspect you're erasing an iterator to the same node twice. Can you show the code where you initialise it_max and max_height_comp between erases?

– Peter Bell
Mar 26 at 20:44





I suspect you're erasing an iterator to the same node twice. Can you show the code where you initialise it_max and max_height_comp between erases?

– Peter Bell
Mar 26 at 20:44













@PeterBell Thanks for the comment. I edited the post.

– ToniAz
Mar 26 at 20:48





@PeterBell Thanks for the comment. I edited the post.

– ToniAz
Mar 26 at 20:48













So let's break this down. All your loop does is erase the maximum item in the set that is greater than or equal to (*(g.vertices.begin()))->max_height;? Is that correct? If so, this does not require a for loop. The max item can be obtained using std::max_element and compare against max_height. If so, erase that iterator.

– PaulMcKenzie
Mar 26 at 20:59






So let's break this down. All your loop does is erase the maximum item in the set that is greater than or equal to (*(g.vertices.begin()))->max_height;? Is that correct? If so, this does not require a for loop. The max item can be obtained using std::max_element and compare against max_height. If so, erase that iterator.

– PaulMcKenzie
Mar 26 at 20:59













3 Answers
3






active

oldest

votes


















1














From the code you've shown, I think you aren't resetting it_max or max_height_comp between loop iterations. Thus on the second loop trip, everything is less than max_height_comp and it_max is never updated.



This problem can be avoided entirely by using a function from <algorithm>, that way the variables are kept within the correct scope by construction.



while (!outstanding.empty())

auto it_max = std::max_element(outstanding.begin(), outstanding.end(),
[](Node * left, Node * right)

return left->max_height < right->max_height;
);

Node * node_max = *it_max;
outstanding.erase(it_max);

// Use the node






share|improve this answer

























  • outstanding is a std::set... There are better ways to get the max element

    – Shawn
    Mar 26 at 21:31











  • How about -- it_max = std::prev(outstanding.end());?

    – PaulMcKenzie
    Mar 26 at 21:36











  • @PaulMcKenzie that won't work because the set is ordered by address and not by height. Furthermore, the set couldn't be ordered by height without losing elements that have the same height as each other.

    – Peter Bell
    Mar 26 at 21:50


















1














You don't appear to be updating max_height_comp for each iteration. After the first time thru the while loop, it will keep the largest value from the previous iteration, so that it_max will not be updated and you'll try to erase that node a second time. You need to reset max_height_comp at the start of every loop, using the data contained within outstanding or a number smaller than any possible value you could have.



There's also the possibility that the initial value for max_height_comp could be larger than any in outstanding which would result in trying to erase a default constructed iterator.






share|improve this answer
































    0














    From the docs here:




    std::set::erase



    Removes from the set container either a single element or a range of elements ([first,last)).



    This effectively reduces the container size by the number of elements removed, which are destroyed.




    It appears that your pointer is not getting updated for some reason, and when erase() is called, it is trying to destroy something that wasn't allocated.






    share|improve this answer



























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55365867%2fright-way-to-remove-an-element-in-stdsetnode%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      From the code you've shown, I think you aren't resetting it_max or max_height_comp between loop iterations. Thus on the second loop trip, everything is less than max_height_comp and it_max is never updated.



      This problem can be avoided entirely by using a function from <algorithm>, that way the variables are kept within the correct scope by construction.



      while (!outstanding.empty())

      auto it_max = std::max_element(outstanding.begin(), outstanding.end(),
      [](Node * left, Node * right)

      return left->max_height < right->max_height;
      );

      Node * node_max = *it_max;
      outstanding.erase(it_max);

      // Use the node






      share|improve this answer

























      • outstanding is a std::set... There are better ways to get the max element

        – Shawn
        Mar 26 at 21:31











      • How about -- it_max = std::prev(outstanding.end());?

        – PaulMcKenzie
        Mar 26 at 21:36











      • @PaulMcKenzie that won't work because the set is ordered by address and not by height. Furthermore, the set couldn't be ordered by height without losing elements that have the same height as each other.

        – Peter Bell
        Mar 26 at 21:50















      1














      From the code you've shown, I think you aren't resetting it_max or max_height_comp between loop iterations. Thus on the second loop trip, everything is less than max_height_comp and it_max is never updated.



      This problem can be avoided entirely by using a function from <algorithm>, that way the variables are kept within the correct scope by construction.



      while (!outstanding.empty())

      auto it_max = std::max_element(outstanding.begin(), outstanding.end(),
      [](Node * left, Node * right)

      return left->max_height < right->max_height;
      );

      Node * node_max = *it_max;
      outstanding.erase(it_max);

      // Use the node






      share|improve this answer

























      • outstanding is a std::set... There are better ways to get the max element

        – Shawn
        Mar 26 at 21:31











      • How about -- it_max = std::prev(outstanding.end());?

        – PaulMcKenzie
        Mar 26 at 21:36











      • @PaulMcKenzie that won't work because the set is ordered by address and not by height. Furthermore, the set couldn't be ordered by height without losing elements that have the same height as each other.

        – Peter Bell
        Mar 26 at 21:50













      1












      1








      1







      From the code you've shown, I think you aren't resetting it_max or max_height_comp between loop iterations. Thus on the second loop trip, everything is less than max_height_comp and it_max is never updated.



      This problem can be avoided entirely by using a function from <algorithm>, that way the variables are kept within the correct scope by construction.



      while (!outstanding.empty())

      auto it_max = std::max_element(outstanding.begin(), outstanding.end(),
      [](Node * left, Node * right)

      return left->max_height < right->max_height;
      );

      Node * node_max = *it_max;
      outstanding.erase(it_max);

      // Use the node






      share|improve this answer













      From the code you've shown, I think you aren't resetting it_max or max_height_comp between loop iterations. Thus on the second loop trip, everything is less than max_height_comp and it_max is never updated.



      This problem can be avoided entirely by using a function from <algorithm>, that way the variables are kept within the correct scope by construction.



      while (!outstanding.empty())

      auto it_max = std::max_element(outstanding.begin(), outstanding.end(),
      [](Node * left, Node * right)

      return left->max_height < right->max_height;
      );

      Node * node_max = *it_max;
      outstanding.erase(it_max);

      // Use the node







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Mar 26 at 21:05









      Peter BellPeter Bell

      3322 silver badges6 bronze badges




      3322 silver badges6 bronze badges















      • outstanding is a std::set... There are better ways to get the max element

        – Shawn
        Mar 26 at 21:31











      • How about -- it_max = std::prev(outstanding.end());?

        – PaulMcKenzie
        Mar 26 at 21:36











      • @PaulMcKenzie that won't work because the set is ordered by address and not by height. Furthermore, the set couldn't be ordered by height without losing elements that have the same height as each other.

        – Peter Bell
        Mar 26 at 21:50

















      • outstanding is a std::set... There are better ways to get the max element

        – Shawn
        Mar 26 at 21:31











      • How about -- it_max = std::prev(outstanding.end());?

        – PaulMcKenzie
        Mar 26 at 21:36











      • @PaulMcKenzie that won't work because the set is ordered by address and not by height. Furthermore, the set couldn't be ordered by height without losing elements that have the same height as each other.

        – Peter Bell
        Mar 26 at 21:50
















      outstanding is a std::set... There are better ways to get the max element

      – Shawn
      Mar 26 at 21:31





      outstanding is a std::set... There are better ways to get the max element

      – Shawn
      Mar 26 at 21:31













      How about -- it_max = std::prev(outstanding.end());?

      – PaulMcKenzie
      Mar 26 at 21:36





      How about -- it_max = std::prev(outstanding.end());?

      – PaulMcKenzie
      Mar 26 at 21:36













      @PaulMcKenzie that won't work because the set is ordered by address and not by height. Furthermore, the set couldn't be ordered by height without losing elements that have the same height as each other.

      – Peter Bell
      Mar 26 at 21:50





      @PaulMcKenzie that won't work because the set is ordered by address and not by height. Furthermore, the set couldn't be ordered by height without losing elements that have the same height as each other.

      – Peter Bell
      Mar 26 at 21:50













      1














      You don't appear to be updating max_height_comp for each iteration. After the first time thru the while loop, it will keep the largest value from the previous iteration, so that it_max will not be updated and you'll try to erase that node a second time. You need to reset max_height_comp at the start of every loop, using the data contained within outstanding or a number smaller than any possible value you could have.



      There's also the possibility that the initial value for max_height_comp could be larger than any in outstanding which would result in trying to erase a default constructed iterator.






      share|improve this answer





























        1














        You don't appear to be updating max_height_comp for each iteration. After the first time thru the while loop, it will keep the largest value from the previous iteration, so that it_max will not be updated and you'll try to erase that node a second time. You need to reset max_height_comp at the start of every loop, using the data contained within outstanding or a number smaller than any possible value you could have.



        There's also the possibility that the initial value for max_height_comp could be larger than any in outstanding which would result in trying to erase a default constructed iterator.






        share|improve this answer



























          1












          1








          1







          You don't appear to be updating max_height_comp for each iteration. After the first time thru the while loop, it will keep the largest value from the previous iteration, so that it_max will not be updated and you'll try to erase that node a second time. You need to reset max_height_comp at the start of every loop, using the data contained within outstanding or a number smaller than any possible value you could have.



          There's also the possibility that the initial value for max_height_comp could be larger than any in outstanding which would result in trying to erase a default constructed iterator.






          share|improve this answer













          You don't appear to be updating max_height_comp for each iteration. After the first time thru the while loop, it will keep the largest value from the previous iteration, so that it_max will not be updated and you'll try to erase that node a second time. You need to reset max_height_comp at the start of every loop, using the data contained within outstanding or a number smaller than any possible value you could have.



          There's also the possibility that the initial value for max_height_comp could be larger than any in outstanding which would result in trying to erase a default constructed iterator.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 26 at 21:02









          1201ProgramAlarm1201ProgramAlarm

          21.1k7 gold badges27 silver badges42 bronze badges




          21.1k7 gold badges27 silver badges42 bronze badges
























              0














              From the docs here:




              std::set::erase



              Removes from the set container either a single element or a range of elements ([first,last)).



              This effectively reduces the container size by the number of elements removed, which are destroyed.




              It appears that your pointer is not getting updated for some reason, and when erase() is called, it is trying to destroy something that wasn't allocated.






              share|improve this answer





























                0














                From the docs here:




                std::set::erase



                Removes from the set container either a single element or a range of elements ([first,last)).



                This effectively reduces the container size by the number of elements removed, which are destroyed.




                It appears that your pointer is not getting updated for some reason, and when erase() is called, it is trying to destroy something that wasn't allocated.






                share|improve this answer



























                  0












                  0








                  0







                  From the docs here:




                  std::set::erase



                  Removes from the set container either a single element or a range of elements ([first,last)).



                  This effectively reduces the container size by the number of elements removed, which are destroyed.




                  It appears that your pointer is not getting updated for some reason, and when erase() is called, it is trying to destroy something that wasn't allocated.






                  share|improve this answer













                  From the docs here:




                  std::set::erase



                  Removes from the set container either a single element or a range of elements ([first,last)).



                  This effectively reduces the container size by the number of elements removed, which are destroyed.




                  It appears that your pointer is not getting updated for some reason, and when erase() is called, it is trying to destroy something that wasn't allocated.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 26 at 20:51









                  Matthew Salvatore ViglioneMatthew Salvatore Viglione

                  6652 silver badges21 bronze badges




                  6652 silver badges21 bronze badges






























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55365867%2fright-way-to-remove-an-element-in-stdsetnode%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                      Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript