X-Git-Url: https://git.donarmstrong.com/?p=rsem.git;a=blobdiff_plain;f=boost%2Frange%2Fsize.hpp;fp=boost%2Frange%2Fsize.hpp;h=6ae74d1176ad386d03f451933294551f02cd3441;hp=0000000000000000000000000000000000000000;hb=2d71eb92104693ca9baa5a2e1c23eeca776d8fd3;hpb=da57529b92adbb7ae74a89861cb39fb35ac7c62d diff --git a/boost/range/size.hpp b/boost/range/size.hpp new file mode 100644 index 0000000..6ae74d1 --- /dev/null +++ b/boost/range/size.hpp @@ -0,0 +1,52 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_SIZE_HPP +#define BOOST_RANGE_SIZE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include +#include + +namespace boost +{ + namespace range_detail + { + template + inline BOOST_DEDUCED_TYPENAME range_size::type + range_calculate_size(const SinglePassRange& rng) + { + BOOST_ASSERT( (boost::end(rng) - boost::begin(rng)) >= 0 && + "reachability invariant broken!" ); + return boost::end(rng) - boost::begin(rng); + } + } + + template + inline BOOST_DEDUCED_TYPENAME range_size::type + size(const SinglePassRange& rng) + { +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ + !BOOST_WORKAROUND(__GNUC__, < 3) \ + /**/ + using namespace range_detail; +#endif + return range_calculate_size(rng); + } + +} // namespace 'boost' + +#endif