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 31,430 of 33,346   
   =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All   
   Re: any_of, all_of, none_of   
   29 Aug 11 05:32:08   
   
   09358158   
   From: daniel.kruegler@googlemail.com   
      
   Am 28.08.2011 20:20, schrieb gast128@hotmail.com:   
   [..]   
   > Actually I have 2 requests:   
   > - all / all_if: value and predicate variants. This one I was posting   
   > about.   
      
   If you want to realize I suggest that you make a official proposal and   
   send it for consideration to the committee.   
      
   > - all / all_if working on ranges instead of [begin, end>. This will   
   > probably offered by Boost.Range in time   
      
   This won't work without a complete proposal for ranges in the library.   
   It wouldn't make sense to provide such a support for a single function   
   template.   
      
   > If the STL doesn't offer a value based one, we can still define one in   
   > our code, preferably in the implementation using the all_of varaint.   
   > Since this is a template (look at the function prototype in previous   
   > post) we cannot use the lambda expressions.   
      
   You claimed this several times and I asked for some evidence. Why   
   shouldn't this work:   
      
   #include    
   #include    
      
   template    
   bool all(For first, For last, const ValueType& rValue)   
   {   
      return std::all_of(first, last,   
         [&](const typename std::iterator_traits::value_type& value)   
        { return rValue == value; }   
      );   
   }   
      
   ?   
      
   > We can use the bind   
   > version but we might have here a small performance or build time   
   > drawback. it would be better if the STL just had defined this in the   
   > beginning (and afaiac with a consistent naming convention).   
      
   There is no reason for binding it, as shown above. If you are not   
   satisfied with the current state, you should make a proposal, but be   
   aware that this will need some time for coming part of the next   
   standard. You should try to find some more reasons except for "just for   
   completeness", because a standard with millions of variants of an   
   algorithm does not necessarily improve the state.   
      
   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