35 #include "DGtal/base/Common.h"
36 #include "DGtal/base/BasicFunctors.h"
37 #include "DGtal/base/OutputIteratorAdapter.h"
38 #include "DGtal/base/IteratorAdapter.h"
44 using namespace DGtal;
58 typedef map<string,string>
Map;
59 typedef pair<string,string> Pair;
63 m.insert( Pair(
"Proudhon",
"Pierre-Joseph" ) );
64 m.insert( Pair(
"Reclus",
"Élisée" ) );
65 m.insert( Pair(
"Zamenhof",
"Ludwik Lejzer" ) );
67 typedef vector<string> Vec;
69 v.push_back(
"P-J." );
71 v.push_back(
"L. L." );
75 m2.insert( Pair(
"Proudhon",
"P-J." ) );
76 m2.insert( Pair(
"Reclus",
"E.") );
77 m2.insert( Pair(
"Zamenhof",
"L. L." ) );
86 Adapter a( m.begin(), f );
88 copy(v.begin(), v.end(), a);
91 flag = std::equal( m.begin(), m.end(), m2.begin() );
95 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")" << std::endl;
108 Adapter a( m.begin(), f );
109 copy(v.begin(), v.end(), a);
110 bool flag1 = std::equal( m.begin(), m.end(), m2.begin() );
113 Adapter aBegin( m.begin(), f);
114 Adapter aEnd( m.end(), f);
115 bool flag2 = std::equal( aBegin, aEnd, v.begin() );
117 nbok += (flag1 && flag2)?1:0;
120 trace.
info() <<
"(" << nbok <<
"/" << nb <<
")" << std::endl;
130 int main(
int argc,
char** argv )
134 for (
int i = 0; i < argc; ++i )
140 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
This class adapts any lvalue iterator so that operator* returns a member on the element pointed to by...
Aim: Adapts an output iterator i with a unary functor f, both given at construction,...
void beginBlock(const std::string &keyword="")
Aim: Define a simple unary functor that returns a reference on the first member of a pair in order to...
DGtal is the top-level namespace which contains all DGtal functions and types.
Go to http://www.sgi.com/tech/stl/ForwardIterator.html.
Go to http://www.sgi.com/tech/stl/OutputIterator.html.
std::unordered_map< Cell, CubicalCellData > Map
int main(int argc, char **argv)