Exemplo n.º 1
0
 typename _TransformIterT<IT,FUN>::Iter
 transform (IT const& source, FUN processingFunc)
 {
   typedef typename _TransformIterT<IT,FUN>::ResVal    ValType;
   typedef typename _TransformIterT<IT,FUN>::TransIter TransIT;
   
   return IterSource<ValType>::build (
       new WrappedLumieraIterator<TransIT> (
           transformIterator (source, processingFunc)));
 }
Exemplo n.º 2
0
 /** @test verify delimiter separated joining of arbitrary collections.
  *        - the first test uses a STL container, which means we need to wrap
  *          into a lib::RangeIter. Moreover, lexical_cast is used to convert
  *          the double numbers into strings.
  *        - the second test uses an inline transforming iterator to build a
  *          series of AutoCounter objects, which provide a custom string
  *          conversion function. Moreover, since the transforming iterator
  *          conforms to the Lumiera Forward Iterator concept, we can just
  *          move the rvalue into the formatting function without much ado
  */
 void
 checkStringJoin()
   {
     vector<double> dubious;
     for (uint i=0; i<10; ++i)
       dubious.push_back(1.1*i);
     
     std::function<AutoCounter(double)> justCount = [](double d){ return AutoCounter(d); };
     
     
     cout << join(dubious, "--+--") << endl;
     cout << join(transformIterator(eachElm(dubious)
                                   ,justCount)) << endl;
   }