Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #7758

Re: STL algorithm for finding first non-matching value

From Kai-Uwe Bux <jkherciueh@gmx.net>
Newsgroups comp.lang.c++
Subject Re: STL algorithm for finding first non-matching value
Followup-To comp.lang.c++
Date 2011-07-12 22:19 +0200
Organization University of Bielefeld
Message-ID <ivia7q$mvm$1@hoshi.visyn.net> (permalink)
References <c0c7e37f-3d7e-4ff0-8272-dae1b5b0ec87@b39g2000prd.googlegroups.com>

Followups directed to: comp.lang.c++

Show all headers | View raw


Stephen Howe wrote:

> Hi
> 
> Maybe I overlooking the obvious, but given that  == operator or an
> equality predicate exists,
> is there an algorithm that find that first value that does not match
> (or end if everything matches)?
> This would be linear (rather that use lower_bound/upper_bound if
> ordered)
> 
> Essentially
> 
> it = some_algorithm(ForwardIteratorStart, ForwardIteratorEnd, Value,
> Predicate);

What about std::find_if()? You can use it with a functor that compares to 
Value.


Best,

Kai-Uwe Bux

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

STL algorithm for finding first non-matching value Stephen Howe <stephen.howe@kantarmedia.com> - 2011-07-12 13:03 -0700
  Re: STL algorithm for finding first non-matching value Kai-Uwe Bux <jkherciueh@gmx.net> - 2011-07-12 22:19 +0200
  Re: STL algorithm for finding first non-matching value Leigh Johnston <leigh@i42.co.uk> - 2011-07-12 21:27 +0100
    Re: STL algorithm for finding first non-matching value Leigh Johnston <leigh@i42.co.uk> - 2011-07-12 21:50 +0100
      Re: STL algorithm for finding first non-matching value Leigh Johnston <leigh@i42.co.uk> - 2011-07-12 22:02 +0100
        Re: STL algorithm for finding first non-matching value Yakov Gerlovin <yakov.gerlovin@gmail.com> - 2011-07-13 01:37 -0700
          Re: STL algorithm for finding first non-matching value Leigh Johnston <leigh@i42.co.uk> - 2011-07-13 12:29 +0100
            Re: STL algorithm for finding first non-matching value Yakov Gerlovin <yakov.gerlovin@gmail.com> - 2011-07-14 01:56 -0700
              Re: STL algorithm for finding first non-matching value Leigh Johnston <leigh@i42.co.uk> - 2011-07-14 13:37 +0100
                Re: STL algorithm for finding first non-matching value Yakov Gerlovin <yakov.gerlovin@gmail.com> - 2011-07-19 08:29 -0700
                Re: STL algorithm for finding first non-matching value James Kanze <james.kanze@gmail.com> - 2011-07-20 13:15 -0700

csiph-web