test/maps_test.cc
changeset 132 50ff949140fa
parent 82 bce6c8f93d10
child 123 8899d1891a3c
equal deleted inserted replaced
3:a0bdb4b8d32d 4:4319df6b7123
    29 using namespace lemon::concepts;
    29 using namespace lemon::concepts;
    30 
    30 
    31 struct A {};
    31 struct A {};
    32 inline bool operator<(A, A) { return true; }
    32 inline bool operator<(A, A) { return true; }
    33 struct B {};
    33 struct B {};
       
    34 
       
    35 class C {
       
    36   int x;
       
    37 public:
       
    38   C(int _x) : x(_x) {}
       
    39 };
    34 
    40 
    35 class F {
    41 class F {
    36 public:
    42 public:
    37   typedef A argument_type;
    43   typedef A argument_type;
    38   typedef B result_type;
    44   typedef B result_type;
    56 
    62 
    57 int main()
    63 int main()
    58 {
    64 {
    59   // Map concepts
    65   // Map concepts
    60   checkConcept<ReadMap<A,B>, ReadMap<A,B> >();
    66   checkConcept<ReadMap<A,B>, ReadMap<A,B> >();
       
    67   checkConcept<ReadMap<A,C>, ReadMap<A,C> >();
    61   checkConcept<WriteMap<A,B>, WriteMap<A,B> >();
    68   checkConcept<WriteMap<A,B>, WriteMap<A,B> >();
       
    69   checkConcept<WriteMap<A,C>, WriteMap<A,C> >();
    62   checkConcept<ReadWriteMap<A,B>, ReadWriteMap<A,B> >();
    70   checkConcept<ReadWriteMap<A,B>, ReadWriteMap<A,B> >();
       
    71   checkConcept<ReadWriteMap<A,C>, ReadWriteMap<A,C> >();
    63   checkConcept<ReferenceMap<A,B,B&,const B&>, ReferenceMap<A,B,B&,const B&> >();
    72   checkConcept<ReferenceMap<A,B,B&,const B&>, ReferenceMap<A,B,B&,const B&> >();
       
    73   checkConcept<ReferenceMap<A,C,C&,const C&>, ReferenceMap<A,C,C&,const C&> >();
    64 
    74 
    65   // NullMap
    75   // NullMap
    66   {
    76   {
    67     checkConcept<ReadWriteMap<A,B>, NullMap<A,B> >();
    77     checkConcept<ReadWriteMap<A,B>, NullMap<A,B> >();
    68     NullMap<A,B> map1;
    78     NullMap<A,B> map1;