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,495 of 33,346   
   Francis Glassborow to goran.pusic@gmail.com   
   Re: Why doesn't push_back return an iter   
   23 Jul 12 13:36:40   
   
   From: francis.glassborow@btinternet.com   
      
   On 23/07/2012 20:16, goran.pusic@gmail.com wrote:   
   > On Monday, July 23, 2012 4:15:18 AM UTC+2, Kaba wrote:   
   >> Hi,   
   >>   
   >> A small but annoying piece of STL is that the push_back and   
   >> push_front member functions of std::list (say) do not return an   
   >> iterator to the created element. This results in having to do   
   >> something like   
   >>   
   >>      auto iter = list.end();   
   >>      --iter;   
   >   
   > auto iter = list.rbegin();   
      
   Unfortunately that gives iter the wrong type unless you wanted a reverse   
   iterator.   
      
   >   
   > is shorter.   
   [...]   
      
   { Trailing quotation snipped. Please trim your quoting and try to include   
     only the minimum necessary to establish the context. -mod }   
      
   --   
         [ 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