From: jm@bourguet.org   
      
   Martin Ba <0xcdcdcdcd@gmx.at> writes:   
      
   > On 04.09.2013 21:49, Jean-Marc Bourguet wrote:   
   >> Martin Ba <0xcdcdcdcd@gmx.at> writes:   
   >>   
   >>>> ... disengaged optional is simply treated as an   
   >>>> additional and unique value of T equal only to itself;   
   >>>> this value is always compared as less than any   
   >>>> value of T ...   
   >>>   
   >>> - seems awful.   
   >>   
   >> If you look at optional as an array of size 0 or 1, it makes   
   >> perfectly sense.   
   >>   
   >   
   > Actually, no. How does it compare to arrays? Please explain?   
      
   As all other containers, a lexicographic sort.   
      
   > Note: I thought about optional being a model of container where   
   > the container can at most store one element of T (or be empty). Did you   
   > mean this by "array"? I don't see how current optional models this?   
      
   AFAIK, it doesn't provide the required interface of containers. But it   
   is one of the mental model which has been used for design the interface   
   of optional<>.   
      
   Having a total order for optional<> is usefull, the tagged union with a   
   null type doesn't provide a strong preference for any order, the array   
   of limited size provide one. Why not use it (IMHO optional should have   
   < iff T has <, it should have less<> iff T has less<>, that's not the   
   current state).   
      
   Yours,   
      
   --   
   Jean-Marc   
      
      
    [ 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)   
|