/* * This file is part of the DXX-Rebirth project . * It is copyright by its individual contributors, as recorded in the * project's Git history. See COPYING.txt at the top level for license * terms and a link to the Git history. */ #pragma once #include "dxxsconf.h" #include "compiler-begin.h" template struct partial_range_t { iterator m_begin, m_end; partial_range_t(iterator b, iterator e) : m_begin(b), m_end(e) { } iterator begin() const { return m_begin; } iterator end() const { return m_end; } }; #ifdef DXX_HAVE_BOOST_FOREACH #include #include namespace boost { template struct range_mutable_iterator< partial_range_t > { typedef iterator type; }; template struct range_const_iterator< partial_range_t > { typedef iterator type; }; } #endif template partial_range_t partial_range(T &t, typename T::size_type l) { auto b = begin(t); return partial_range_t(b, b + l); } template partial_range_t partial_range(const T &t, typename T::size_type l) { auto b = begin(t); return partial_range_t(b, b + l); }