The following function constructs a std::vector<std::byte> object which is used for passing bind-arguments to a Query-object.
Line 4 specifies the variable to which values should be bound. Multiple items may be bound to a value, they are separated by a 0x01 byte. And each item consists of a value-string and a type-specifier (lines 6-8).
Line 10 removes the trailing 0x01.
The function does exactly what is expected.
This function uses a constant "" for the type, 'addVoid' replaces an empty string by a 0x00.
Is it possible to - after providing a third argument, typeList to the function - to change the loop in such a way that both lists are evaluated simultaneously? (Of course after checking that both lists have the same size).
It's possible but not with range for loop, instead you need the vintage version of the for loop :)
1 2 3 4 5 6
for (auto iter1 = list1.begin(), iter2 = list2.begin();
(iter1 != list1.end()) && (iter2 != list2.end());
++iter1, ++iter2)
{
// TODO: Insert code here to use iterators to both lists
}
btw: the "vintage" code is how B. Stroustrup calls code which does not use modern language features.