I am trying to understand how to use datasets with the boost.test library. I am following the documentation here and have created my dataset as follows:

namespace bdata = boost::unit_test::data;

struct test_set {

    class iterator {

        int m_a;

    public:

        iterator()
        : m_a(0){}

        void operator++() {
            ++m_a;
        }

        int operator*() const {
            return m_a;
        }
    };

    using sample = int;
    enum {arity = 1};

    auto begin() const {
        return iterator{};
    }

    bdata::size_t size() const {
        return 5; // let's assume only 5 numbers
    }
};

namespace boost { namespace unit_test { namespace data  { namespace monomorphic {

                template <>
                struct is_dataset<test_set> : std::true_type{};
            }}}}

which is very simple and iterates numbers from 0 to 4.

The following simple test compiles and runs just fine:


// this works as expected and prints 0, 1, 2, 3, 4
BOOST_DATA_TEST_CASE(
example_test1,
test_set(),
my_datum) {

        std::cout << my_datum << std::endl;
}
However, when I try to zip two such datasets it fails to compile (Apple LLVM version 9.0.0 (clang-900.0.38)):

// error: invalid operands to binary expression ('typename data::result_of::make<test_set>::type' (aka 'test_set') and 'test_set') test_set() ^ test_set(),
//                                                                                                                                 ~~~~~~~~~~~^~~~~~~~~~~~~
BOOST_DATA_TEST_CASE(
example_test2,
test_set() ^ test_set(),
my_datum1, my_datum2) {

        std::cout << my_datum1 << " " << my_datum2 << std::endl;
}

Is what I am trying to do legal? If so, what is the correct way to achieve it? Thank you for your help!

Live code here