Changeset 2338 for trunk/test/Suite.h


Ignore:
Timestamp:
Oct 16, 2010, 7:00:12 AM (11 years ago)
Author:
Peter
Message:

adding an archetype class for distance concept and use that class in KNN and NCC. Adding CopyConstructible? to requirement for Distance concept

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/Suite.h

    r2260 r2338  
    2323  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2424*/
     25
     26#include <boost/concept_archetype.hpp>
    2527
    2628#include <iosfwd>
     
    219221    reference operator()(size_t row, size_t column)
    220222    { return this->element_; }
     223  };
     224
     225  /*
     226    class to test (at compile time) that a function (or class) works
     227    with a Distance. Do not run any test using this class because
     228    the class is not really functional at run time.
     229
     230    \see boost/concept_archetype.hpp
     231   */
     232  class distance_archetype
     233  {
     234  public:
     235    /// class must be constructible somehow, but we don't wanna assume
     236    /// void constructor or any other common constructor so we use the
     237    /// signature to allow construction without assuming too much.
     238    distance_archetype(const boost::detail::dummy_constructor&) {};
     239    distance_archetype(const distance_archetype&) {};
     240    template<typename T1, typename T2>
     241    double operator()(T1 first1, T1 last1, T2 first2) const { return 0.0; }
     242  private:
     243    distance_archetype(void);
     244    distance_archetype& operator=(const distance_archetype&);
    221245  };
    222246
Note: See TracChangeset for help on using the changeset viewer.