Boost C++ Libraries

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

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Function xrange

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

Synopsis

// 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);
template<typename SampleType> 
  monomorphic::generated_by< monomorphic::xrange_t< SampleType > > 
  xrange(SampleType const & end_val);
template<typename SampleType, typename Params> 
  enable_if_c< nfp::is_named_param_pack< Params >::value, monomorphic::generated_by< monomorphic::xrange_t< SampleType > > >::type 
  xrange(SampleType const & end_val, Params const & params);
template<typename SampleType> 
  monomorphic::generated_by< monomorphic::xrange_t< SampleType > > 
  xrange(SampleType const & begin_val, SampleType const & end_val);
template<typename SampleType, typename StepType> 
  monomorphic::generated_by< monomorphic::xrange_t< SampleType > > 
  xrange(SampleType const & begin_val, SampleType const & end_val, 
         StepType const & step_val);

Description

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.


PrevUpHomeNext