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,793 of 33,346   
   =?ISO-8859-15?Q?Daniel_Kr=FCgler?= to Frank Birbacher   
   Re: c++11 std containers must construct    
   14 Jan 13 07:07:18   
   
   From: daniel.kruegler@googlemail.com   
      
   On 2013-01-13 21:24, Frank Birbacher wrote:   
     > I'm playing around with allocators in c++11 using   
     > clang+libcxx. I've come across a problem in range-constructing a   
     > list from iterators over a different value_type.   
     >   
     > My central question: Is a std container allowed to construct any   
     > instances of its value_type without using the construct method of   
     > the allocator?   
     >   
     > I have the expectation that it should. Suppose the following   
     > implementation of a std::list range constructor. If the   
     > Iter::value_type differs from the list::value_type, may the list   
     > construct a temporary list::value_type in the call to push_back?   
      
   I don't think that this would be conforming, because the requirements   
   of Table 100 describe the expression X(i, j):   
      
   "Requires: T shall be EmplaceConstructible into X from *i."   
      
   There is no requirement in regard to "convertible to value_type" or   
   that "value_type shall be move/copy-constructible", so I would argue   
   that a call of push_back in this context would be not correct (when   
   the difference is observable).   
      
   This looks like a defect in regard to the libstdc++ and libc++   
   implementation which I'm in the process to report.   
      
   HTH & Greetings from Bremen,   
      
   Daniel Krügler   
      
      
   --   
         [ 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