stlab.adobe.com Adobe Systems Incorporated

for_each_position.hpp

Go to the documentation of this file.
00001 /*
00002     Copyright 2005-2007 Adobe Systems Incorporated
00003     Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
00004     or a copy at http://stlab.adobe.com/licenses.html)
00005 */
00006 
00007 /*************************************************************************************************/
00008 
00009 #ifndef ADOBE_ALGORITHM_FOR_EACH_POSITION_HPP
00010 #define ADOBE_ALGORITHM_FOR_EACH_POSITION_HPP
00011 
00012 #include <adobe/config.hpp>
00013 
00014 #include <boost/bind.hpp>
00015 #include <boost/range/begin.hpp>
00016 #include <boost/range/end.hpp>
00017 
00018 #include <algorithm>
00019 
00020 /*************************************************************************************************/
00021 
00022 namespace adobe {
00023 
00024 /*************************************************************************************************/
00036 /*************************************************************************************************/
00037 #ifndef ADOBE_NO_DOCUMENTATION
00038 namespace implementation {
00039 
00040 /*************************************************************************************************/
00041 
00042 template <class InputIterator, class UnaryFunction>
00043 void for_each_position(InputIterator first, InputIterator last, UnaryFunction f)
00044 {
00045     while (first != last)
00046     {
00047         f(first);
00048         ++first;
00049     }
00050 }
00051 
00052 /*************************************************************************************************/
00053 
00054 } // namespace implementation
00055 #endif
00056 /*************************************************************************************************/
00062 template <class InputIterator, class UnaryFunction>
00063 inline void for_each_position(InputIterator first, InputIterator last, UnaryFunction f)
00064 {
00065     adobe::implementation::for_each_position(first, last, boost::bind(f, _1));
00066 }
00067 
00073 template <class InputRange, class UnaryFunction>
00074 inline void for_each_position(InputRange& range, UnaryFunction f)
00075 {
00076     adobe::for_each_position(boost::begin(range), boost::end(range), f);
00077 }
00078 
00084 template <class InputRange, class UnaryFunction>
00085 inline void for_each_position(const InputRange& range, UnaryFunction f)
00086 {
00087     adobe::for_each_position(boost::begin(range), boost::end(range), f);
00088 }
00089 
00090 /*************************************************************************************************/
00091 
00092 } // namespace adobe
00093 
00094 /*************************************************************************************************/
00095 
00096 #endif
00097 
00098 /*************************************************************************************************/

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google