Changeset 2373


Ignore:
Timestamp:
Dec 12, 2010, 8:21:41 AM (12 years ago)
Author:
Peter
Message:

adding docs on type requirements in Container2DIterator. Adding some concept check of these requirements. closes #596.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/Container2DIterator.h

    r2121 r2373  
    2424*/
    2525
     26#include "concept_check.h"
    2627#include "iterator_traits.h"
    2728#include "yat_assert.h"
    2829
     30#include <boost/concept_check.hpp>
    2931#include <boost/iterator/iterator_facade.hpp>
    3032
     
    4345     The iterator can be used to traverse through a \ref
    4446     concept_container_2d row by row.
     47
     48     Type Requirements:
     49     - \c Container must be a \ref concept_container_2d
     50     - \c value is typically \c Container::value_type if
     51       Container2DIterator is mutable or \c const \c
     52       Container::value_type otherwise.
     53     - \c reference, typically \c value&, must be convertible to \c
     54       value
     55     - \c Container must have an \c operator()(size_t, size_t) that
     56       returns a type that is convertible to \c reference.
    4557
    4658     \see StrideIterator
     
    6173       \brief Default Constructor
    6274    */
    63     Container2DIterator(void) {};
     75    Container2DIterator(void)
     76    {
     77      BOOST_CONCEPT_ASSERT((Container2D<Container>));
     78      BOOST_CONCEPT_ASSERT((boost::Convertible<reference,value>));
     79    };
    6480
    6581    /**
     
    7187    */
    7288    Container2DIterator(Container& container, size_t row, size_t column)
    73       : container_(&container), index_(row*container.columns()+column) {}
     89      : container_(&container), index_(row*container.columns()+column)
     90    {
     91      BOOST_CONCEPT_ASSERT((Container2D<Container>));
     92      BOOST_CONCEPT_ASSERT((boost::Convertible<reference,value>));
     93    }
    7494
    7595  private:
Note: See TracChangeset for help on using the changeset viewer.