Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

boost::unit_test::data operator ^ ?

Tags:

boost

I was reading the boost documentation and I came across this:

fibonacci_dataset() ^ bdata::make( { 1, 2, 3, 5, 8, 13, 21, 35, 56 } )

The ^ operator seems to concatenate two datasets together. Is there documentation on this, or do I have to source dive?

like image 437
bot1131357 Avatar asked Jul 05 '26 23:07

bot1131357


1 Answers

What you're referring to is actually a zip operation on a pair of datasets.

From the documentation page of dataset operations:

A zip, denoted ^ , is an operation on two datasets dsa and dsb of same arity and same size, resulting in a dataset where the k-th sample of dsa is paired with the corresponding k-th sample of dsb. The resulting dataset samples order follows the left to right order against the symbol ^.

dsa = (a_1, a_2, ... a_i)
dsb = (b_1, b_2, ... b_i)
dsa ^ dsb = ( (a_1, b_1), (a_2, b_2) ... (a_i, b_i) )

Hence, in the example you mention, the result is a sequence of pairs of calculated and expected Fibonacci values.

like image 163
Dan Mašek Avatar answered Jul 11 '26 04:07

Dan Mašek