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 to view this page for the latest version.
PrevUpHomeNext

Class template collection

boost::unit_test::data::monomorphic::collection — Dataset from a forward iterable container (collection)

Synopsis

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

template<typename C> 
class collection : public boost::unit_test::data::monomorphic::dataset< boost::decay< C >::type::value_type >
{
public:
  // member classes/structs/unions

  struct iterator :
    public boost::unit_test::data::monomorphic::dataset< T >::iterator
  {
    // construct/copy/destruct
    explicit iterator(collection< C > const &);

    // public member functions
    virtual T const & operator*();
    virtual void operator++();
  };

  enum @4 { arity = = 1 };
  // construct/copy/destruct
  explicit collection(C &&);
  collection(collection &&);

  // public member functions
  C const & col() const;
  virtual data::size_t size() const;
  virtual iter_ptr begin() const;
};

Description

This dataset is applicable to any container implementing a forward iterator. Note that container with one element will be considered as singletons. This dataset is constructible with the boost::unit_test::data::make function.

For compilers supporting r-value references, the collection is moved instead of copied.

collection public construct/copy/destruct

  1. explicit collection(C && col);
    Constructor The collection is moved.
  2. collection(collection && c);
    Move constructor.

collection public member functions

  1. C const & col() const;
    Returns the underlying collection.
  2. virtual data::size_t size() const;
    Dataset size.
  3. virtual iter_ptr begin() const;
    Iterator to use to iterate over this dataset.

PrevUpHomeNext