00001 #ifndef ORDER2_STATISTICAL_CONCEPT_H 00002 #define ORDER2_STATISTICAL_CONCEPT_H 00003 00004 #include <boost/concept/assert.hpp> 00005 #include <boost/concept/usage.hpp> 00006 00007 namespace za_co_codespot 00008 { 00009 namespace datastructures 00010 { 00011 00035 template <typename T> 00036 struct Order2StatisticalConcept 00037 { 00038 public: 00039 BOOST_CONCEPT_USAGE(Order2StatisticalConcept) 00040 { 00041 T z0(0); //constructor with 0 00042 bool b = x <= y; //less than or equal to 00043 00044 T z1 = x; //assignable 00045 T z2 = x + y; //addable 00046 T z3 = z2 / (unsigned int) 2;//integer divisable 00047 T z4 = x - y; //difference 00048 T z5 = sqr(x); //sqr 00049 } 00050 00051 private: 00052 T x; 00053 T y; 00054 }; 00055 00062 template<typename T> 00063 class Order2StatisticalArchetype 00064 { 00065 public: 00066 Order2StatisticalArchetype(){}; 00067 Order2StatisticalArchetype(T v){}; 00068 bool operator<=(const Order2StatisticalArchetype<T> other){return true;} 00069 Order2StatisticalArchetype<T> operator+(const Order2StatisticalArchetype<T> other){return *this;} 00070 Order2StatisticalArchetype<T> operator/(unsigned int n){return *this;} 00071 Order2StatisticalArchetype<T> operator-(const Order2StatisticalArchetype<T> other){return *this;} 00072 }; 00073 00078 template<typename T> 00079 Order2StatisticalArchetype<T> sqr(const Order2StatisticalArchetype<T> & x) {return x;} 00080 00081 } //end namespace datastructures 00082 } //end namespace za_co_codespot 00083 00084 #endif //ORDER2_STATISTICAL_CONCEPT_H