Changeset 2260


Ignore:
Timestamp:
May 26, 2010, 1:48:54 AM (13 years ago)
Author:
Peter
Message:

fixes #626

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/Suite.h

    r2228 r2260  
    217217    column_iterator end_column(size_t) { return NULL; }
    218218    iterator end_row(size_t) { return NULL; }
    219     reference operator()(size_t row, size_t column) const
     219    reference operator()(size_t row, size_t column)
    220220    { return this->element_; }
    221221  };
  • trunk/test/concept_test.cc

    r2259 r2260  
    2424#include "yat/utility/concept_check.h"
    2525#include "yat/utility/DataWeight.h"
     26#include "yat/utility/Matrix.h"
     27#include "yat/utility/MatrixWeighted.h"
    2628
    2729#include "yat/classifier/MatrixLookup.h"
     
    3638  test::Suite suite(argc, argv);
    3739  using namespace utility;
     40  using namespace test;
    3841
    3942  BOOST_CONCEPT_ASSERT((Container2D<test::container2d_archetype<double> >));
     
    4447  //  BOOST_CONCEPT_ASSERT((Container2D<classifier::KernelLookup>));
    4548
     49  // concept Mutable_Container2D
     50  BOOST_CONCEPT_ASSERT((Mutable_Container2D<mutable_container2d_archetype<double> >));
     51  BOOST_CONCEPT_ASSERT((Mutable_Container2D<mutable_container2d_archetype<DataWeight> >));
     52  BOOST_CONCEPT_ASSERT((Mutable_Container2D<Matrix>));
     53  BOOST_CONCEPT_ASSERT((Mutable_Container2D<MatrixWeighted>));
     54 
     55
     56
    4657  return suite.return_value();
    4758}
  • trunk/yat/utility/concept_check.h

    r2259 r2260  
    8585  };
    8686
     87  /**
     88     \brief Concept check for \ref concept_mutable_container_2d
     89
     90     This class is intended to be used in a <a
     91     href="\boost_url/concept_check/using_concept_check.htm">
     92     BOOST_CONCEPT_ASSERT </a>
     93
     94     \code
     95     template<class T>
     96     void some_function(const T& t)
     97     {
     98     BOOST_CONCEPT_ASSERT((Mutable_Container2D<T>));
     99     ...
     100     }
     101     \endcode
     102  */
     103  template <class T>
     104  class Mutable_Container2D : public Container2D<T>
     105  {
     106  public:
     107    /// reference
     108    typedef typename T::reference reference;
     109    /// iterator
     110    typedef typename T::iterator iterator;
     111    /// row_iterator
     112    typedef typename T::row_iterator row_iterator;
     113    /// column_iterator
     114    typedef typename T::column_iterator column_iterator;
     115
     116    /**
     117       \brief function doing the concept test
     118     */
     119    BOOST_CONCEPT_USAGE(Mutable_Container2D)
     120    {
     121      iterator iter_ = t_.begin();
     122      iter_ = t_.end();
     123      row_iterator row_iter_ = t_.begin_row(0);
     124      row_iter_ = t_.end_row(0);
     125      column_iterator col_iter_ = t_.begin_column(0);
     126      col_iter_ = t_.end_column(0);
     127      reference r = t_(0,0);
     128      t_(0,0) = r;
     129      using boost::Mutable_RandomAccessIterator; // just to avoid long lines
     130      BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIterator<iterator>));
     131      BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIterator<row_iterator>));
     132      BOOST_CONCEPT_ASSERT((Mutable_RandomAccessIterator<column_iterator>));
     133    }
     134  private:
     135    T t_;
     136  };
     137
    87138}}} // of namespace utility, yat, and theplu
    88139#endif
Note: See TracChangeset for help on using the changeset viewer.