Skip to content
Snippets Groups Projects
  1. Aug 26, 2016
  2. Aug 23, 2016
  3. Aug 18, 2016
  4. Aug 17, 2016
  5. Aug 16, 2016
  6. Aug 10, 2016
  7. Dec 03, 2015
  8. Dec 01, 2015
  9. Nov 20, 2015
  10. Nov 17, 2015
  11. Apr 17, 2008
  12. Apr 14, 2008
    • Fons Rademakers's avatar
      From Anar and me: · dd5bdc5a
      Fons Rademakers authored
      The background is the following. While working on the PROOF code I found
      that enumerating TList is an inconvenient and a long operation, I had to
      write the same code all over the place and make duplications. I tried
      to use STD algorithms with it, namely std::for_each, and failed.
      I therefore decided to enable std::for_each algorithm for ROOT 
      Containers/Iterators by making as few as possible changes, without rewriting
      iterators at all. Now with only two simple lines of code one is able to
      iterate through a container:
      
      TIter iter(&list);
      for_each(iter.Begin(), TIter::End(), SEnumFunctor());
      
      or
      
      for_each(iter.Begin(), inter_end, SEnumFunctor());
      
      where iter_end could be an iterator to a middle of the container.
      
      After I had changed Iterators so that they could be used with std::for_each,
      I decided to go further and did some more changes. As a result,
      
        - I have updated CINT implementation of some algorithms (they look now
          more or less better in terms of the standard),
      
        - TList and TObjArray can be now used with std::for_each, std::find_if,
          std::count_if (probably with some more algorithms. I've listed here
          only what has been *checked* by me). Other containers will be supported
          in a next patch.
      
        - A test program has been added: $ROOTSYS/test/stressIterators.cxx
      
        - A tutorial macro has been added: $ROOTSYS/tutorials/cont/TListAndSTL.C
      
      Patch has been verified on Linux, MacOS X, Solaris 10 i386 and Windows.
      
      
      git-svn-id: http://root.cern.ch/svn/root/trunk@23198 27541ba8-7e3a-0410-8455-c3a389f83636
      dd5bdc5a
Loading