Strengthen the data-driven join mechanism `+` corrupts the first column

Consider the following code:

BOOST_DATA_TEST_CASE(
      sampleTest,
      (data::make(1) ^ data::make(2)) + (data::make(3) ^ data::make(4)),
      var1,
      var2)
{
  std::cout << var1 << "," << var2 << std::endl;
}

Expected Result:

1,2
3,4

However, var1it turns out to be damaged:

$> ./MyTests --run_test=Tests/sampleTest
Running 2 test cases...
202875304,2
202875304,4

*** No errors detected
$> ./MyTests --run_test=Tests/sampleTest
Running 2 test cases...
83976616,2
83976616,4

*** No errors detected

Am I doing something wrong?

+6
source share
1 answer

This is mistake. In short: please notify the library staff.

Indeed, the operation zipreturns a tuple std::tuple<int const&, int const&>:

and, although the dataset itself is currently well alive, the tuple is returned by reference in the operation join...:

    sample const&       operator*() const   { return m_first_size > 0 ? *m_it1 : *m_it2; }

, ::sample, ::reference. .


¹

+2

All Articles