distance.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_ITERATOR_DISTANCE_HPP 00010 #define ADOBE_ITERATOR_DISTANCE_HPP 00011 00012 #include <adobe/config.hpp> 00013 00014 #include <iterator> 00015 00016 #include <boost/range/difference_type.hpp> 00017 00018 /*************************************************************************************************/ 00019 00020 namespace adobe { 00021 00022 /*************************************************************************************************/ 00023 00028 template <typename I> // I models InputRange 00029 inline boost::difference_type<I>::type distance(I& range) 00030 { return std::distance(boost::begin(range), boost::end(range)); } 00031 00032 /*************************************************************************************************/ 00033 00034 } // namespace adobe 00035 00036 /*************************************************************************************************/ 00037 00038 #endif 00039 // ADOBE_ITERATOR_DISTANCE_HPP |