1 /* -*- mode: C++; indent-tabs-mode: nil; -*- |
1 /* -*- mode: C++; indent-tabs-mode: nil; -*- |
2 * |
2 * |
3 * This file is a part of LEMON, a generic C++ optimization library. |
3 * This file is a part of LEMON, a generic C++ optimization library. |
4 * |
4 * |
5 * Copyright (C) 2003-2008 |
5 * Copyright (C) 2003-2011 |
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
7 * (Egervary Research Group on Combinatorial Optimization, EGRES). |
7 * (Egervary Research Group on Combinatorial Optimization, EGRES). |
8 * |
8 * |
9 * Permission to use, modify and distribute this software is granted |
9 * Permission to use, modify and distribute this software is granted |
10 * provided that this copyright notice appears in all copies. For |
10 * provided that this copyright notice appears in all copies. For |
67 checkConcept<ReadMap<A,C>, ReadMap<A,C> >(); |
67 checkConcept<ReadMap<A,C>, ReadMap<A,C> >(); |
68 checkConcept<WriteMap<A,B>, WriteMap<A,B> >(); |
68 checkConcept<WriteMap<A,B>, WriteMap<A,B> >(); |
69 checkConcept<WriteMap<A,C>, WriteMap<A,C> >(); |
69 checkConcept<WriteMap<A,C>, WriteMap<A,C> >(); |
70 checkConcept<ReadWriteMap<A,B>, ReadWriteMap<A,B> >(); |
70 checkConcept<ReadWriteMap<A,B>, ReadWriteMap<A,B> >(); |
71 checkConcept<ReadWriteMap<A,C>, ReadWriteMap<A,C> >(); |
71 checkConcept<ReadWriteMap<A,C>, ReadWriteMap<A,C> >(); |
72 checkConcept<ReferenceMap<A,B,B&,const B&>, ReferenceMap<A,B,B&,const B&> >(); |
72 checkConcept<ReferenceMap<A,B,B&,const B&>, |
73 checkConcept<ReferenceMap<A,C,C&,const C&>, ReferenceMap<A,C,C&,const C&> >(); |
73 ReferenceMap<A,B,B&,const B&> >(); |
|
74 checkConcept<ReferenceMap<A,C,C&,const C&>, |
|
75 ReferenceMap<A,C,C&,const C&> >(); |
74 |
76 |
75 // NullMap |
77 // NullMap |
76 { |
78 { |
77 checkConcept<ReadWriteMap<A,B>, NullMap<A,B> >(); |
79 checkConcept<ReadWriteMap<A,B>, NullMap<A,B> >(); |
78 NullMap<A,B> map1; |
80 NullMap<A,B> map1; |
197 FunctorToMap<F> map1; |
199 FunctorToMap<F> map1; |
198 FunctorToMap<F> map2 = FunctorToMap<F>(F()); |
200 FunctorToMap<F> map2 = FunctorToMap<F>(F()); |
199 B b = functorToMap(F())[A()]; |
201 B b = functorToMap(F())[A()]; |
200 |
202 |
201 checkConcept<ReadMap<A,B>, MapToFunctor<ReadMap<A,B> > >(); |
203 checkConcept<ReadMap<A,B>, MapToFunctor<ReadMap<A,B> > >(); |
202 MapToFunctor<ReadMap<A,B> > map = MapToFunctor<ReadMap<A,B> >(ReadMap<A,B>()); |
204 MapToFunctor<ReadMap<A,B> > map = |
|
205 MapToFunctor<ReadMap<A,B> >(ReadMap<A,B>()); |
203 |
206 |
204 check(functorToMap(&func)[A()] == 3, |
207 check(functorToMap(&func)[A()] == 3, |
205 "Something is wrong with FunctorToMap"); |
208 "Something is wrong with FunctorToMap"); |
206 check(mapToFunctor(constMap<A,int>(2))(A()) == 2, |
209 check(mapToFunctor(constMap<A,int>(2))(A()) == 2, |
207 "Something is wrong with MapToFunctor"); |
210 "Something is wrong with MapToFunctor"); |