Given a container of boolean values (An example is std::vector<bool>
), is there a standard function that returns true
if all the values are true
("and") or true
if at least one value is true
("or"), with short circuit evalutation ?
I digged trough www.cplusplus.com this morning but couldn't find anything close.
<algorithm>
and<functional>
for tons of convenience functions and classes whose implementation is trivial. – Salzburgstd::string
because he knows how to do that himself. Sure he does, but as a result his code is often unmaintainable and cluttered with trivial tricks. – Hokkufor
, is. – Swatchstd::string
is "huge"? – Ancillarymemcpy
orstd::copy
? After all, it is just a singlefor
loop. – Hokkustd::copy
, butmemcpy
uses some processor specific instructions which make it faster... and what I meant is that the c++ library will just become more bloated when people like you ask for features that you can use for yourself. a simple static hello world is already few kilobytes when all it does is write 1 line to the screen. – Swatchstd::all_of
andstd::any_of
:) Moreover, if these simple functions are inlinable (which they surely are), what size difference with "rolling out my own version of these functions" does it make anyway ? – Hokku