Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards


Function template xrange

boost::unit_test::data::xrange — Creates a range (sequence) dataset.


// In header: <boost/test/data/monomorphic/generators/xrange.hpp>

template<typename SampleType, typename Params> 
  monomorphic::generated_by< monomorphic::xrange_t< SampleType > > 
  xrange(Params const & params);


The following overloads are available:

auto d = xrange();
auto d = xrange(end_val);
auto d = xrange(end_val, param);
auto d = xrange(begin_val, end_val);
auto d = xrange(begin_val, end_val, step_val);
auto d = xrange(param);
  • begin_val indicates the start of the sequence (default to 0).

  • end_val is the end of the sequence. If ommited, the dataset has infinite size.

  • step_val is the step between two consecutive elements of the sequence, and defaults to 1.

  • param is the named parameters that describe the sequence. The following parameters are accepted:

    • begin: same meaning begin_val

    • end: same meaning as end_val

    • step: same meaning as step_val

The returned value is an object that implements the dataset API.

[Note] Note

the step size cannot be null, and it should be positive if begin_val < end_val, negative otherwise.