[Lldb-commits] [PATCH] D40537: Simplify UUID::IsValid()
Stephane Sezer via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 28 10:18:17 PST 2017
sas added a comment.
In https://reviews.llvm.org/D40537#937880, @zturner wrote:
> In https://reviews.llvm.org/D40537#937866, @sas wrote:
> > In https://reviews.llvm.org/D40537#937196, @zturner wrote:
> > > You could use llvm's range adapters to make this slightly better.
> > >
> > > auto Bytes = makeArrayRef(m_uuid, m_num_uuid_bytes);
> > > return llvm::find(Bytes, 0) != Bytes.end();
> > >
> > >
> > > Another option would just be `return *this != UUID(m_num_uuid_bytes);`
> > We want at least one **non-zero** element, we don't want a zero-element, so the proposed code wouldn't work. I'm not sure if there's an llvm utility that allows doing that directly without having to pass a lambda.
> Wouldn't the other alternative work, where you just use `operator==` against a default constructed instance?
The other alternative seems a bit less explicit to me but I don't mind it too much. What's the issue with using `std::any_of` exactly?
More information about the lldb-commits