<xstd/bits/bit_algorithm/bit_transform.hpp>¶
bit_transform¶
As ranges::transform in [alg.transform], with:
- Constraints:
R, orR1andR2, are sequences of ours, windows included;Ois an output iterator of ours;invocable<F&, bool>, orinvocable<F&, bool, bool>, is modeled and its result converts tobool. A function takingbool&, or answering astring, is turned away. - Effects: The unary form calls
f(false)andf(true)once each; the binary form callsfonce at each of the four pairs. The answers make a truth table that is applied as one block expression, a block of the destination at a time asbit_copywrites it: for the unary form(x & T) | (~x & U), whereTandUare all ones or all zeros asf(true)andf(false)answer. The binary form goes as far as the shorter input.outmay beranges::begin(r1), as [alg.transform] allows. - Complexity: Exactly two applications of
ffor the unary form and four for the binary, whateverN, an empty input included; O(N/D) block operations. - Remarks: The positions written are those
ranges::transformwrites; a function with side effects sees two or four calls whereranges::transformmakes one per element.