From: francis.glassborow@btinternet.com   
      
   On 23/04/2013 05:33, Balog Pal wrote:   
   > On 4/22/2013 12:47 AM, Francis Glassborow wrote:   
   >> On 20/04/2013 22:49, Jonathan Thornburg wrote:   
   >>> Martin Ba <0xcdcdcdcd@gmx.at> wrote:   
   >>   
      
   >>> But it's not clear to me that the reason (explained by Cline in   
   >>> the first of those FAQ entries) *why* it's illegal to implicitly   
   >>> convert foo** to const foo** should apply to converting   
   >>> std::vector to std::vector . That is, I don't   
   >>> see any way in which allowing this implicit conversion would open   
   >>> a hole in the type system. Can anyone clarify this point for me?   
   >>   
   >> The problem is actually unrelated to issues with the safety of the   
   >> type system. The problem is with templates. These create unrelated   
   >> types. So there is no relationship in so far as the language   
   >> specification is concerned, between std::vector and   
   >> std::vector   
   >   
   > The same is true for auto_ptr and auto_ptr (and   
   > many other flavors), yet they are implicitly convertible.   
      
   But those are, AFAIK, all types of 'smart pointer' where the API is   
   clear and limited.   
      
   Obviously we could do the same thing for containers of pointers.   
   However that would mean a partial specialisation for each of the   
   container templates. And are you proposing that the mechanism shall   
   also deal with inheritance relationships (which it necessarily does   
   for smart pointers)   
      
   Note that the Library working group on whose shoulders this would fall   
   are very seriously overloaded with work already.   
      
   Finally, if it is reasonably easy why has Boost not already done it   
   for their own containers (or perhaps they have because I am relatively   
   unfamiliar with their work)   
      
   Francis   
      
      
   --   
    [ 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)   
|