home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,114 of 33,346   
   Ulrich Eckhardt to All   
   Re: rvalue containers - more problems   
   11 Apr 12 09:55:50   
   
   From: ulrich.eckhardt@dominolaser.com   
      
   Am 09.04.2012 23:00, schrieb Dave Abrahams:   
   > on Mon Apr 09 2012, Gene Bushuyev  wrote:   
   >> This time I stumbled upon a problem using rather common   
   >> std::set container when I needed to move a large set of   
   >> strings to another container. As far as I can see, there is no way   
   >> to move strings from the set, because set provides only const   
   >> iterator.  There are no functions in the set class which would allow   
   >> moving either whole set or an iterator range to another container.   
   >   
   > This is for the same reason you can't make other modifications to the   
   > values in a set: it would corrupt the sort order, one of the set's   
   > invariants.   
      
   If I understand the OP correctly, then he meant something like   
   std::list's splice() function. I see no fundamental reason that this   
   couldn't be implemented for [multi]{set,map}.   
      
   One drawback though is that this would either unbalance the internal   
   tree structure or require possibly expensive rebalancing. Also, it   
   suddenly exposes implicitly that the internal structure is a tree made   
   up of separate nodes, which is not guaranteed. I could well imagine the   
   nodes being held in a vector with indices replacing the pointers of a   
   "normal" tree.   
      
   Uli   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca