Date: Sun, 25 Aug 2019 18:28:15 +0200
Hi all,
thanks for the replies so far!
I think that Miguel's solution
all_of(v.cbegin(), v.cend(), identity())
is most in the spirit of
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rp-what
… but it will be a long time before most of us will be able to use
C++20, I'm afraid!
As for Arthur's ideas, all of them, aside from the one with std::find
are in the original attachment, but I think that only the latter and the
one using a lambda qualify as real solutions in the sense of the Core
Guidelines, unless you deliberately want to leave silly puzzles for the
next maintenance programmer.
Best,
Alexander
thanks for the replies so far!
I think that Miguel's solution
all_of(v.cbegin(), v.cend(), identity())
is most in the spirit of
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rp-what
… but it will be a long time before most of us will be able to use
C++20, I'm afraid!
As for Arthur's ideas, all of them, aside from the one with std::find
are in the original attachment, but I think that only the latter and the
one using a lambda qualify as real solutions in the sense of the Core
Guidelines, unless you deliberately want to leave silly puzzles for the
next maintenance programmer.
Best,
Alexander
Received on 2019-08-25 11:30:21