1// (C) Copyright Gennadiy Rozental 2001.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5
6// See http://www.boost.org/libs/test for the library home page.
7//
8// File : $RCSfile$
9//
10// Version : $Revision: 74248 $
11//
12// Description : support for backward compatible collection comparison interface
13// ***************************************************************************
14
15#ifndef BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER
16#define BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER
17
18#ifdef BOOST_TEST_NO_OLD_TOOLS
19
20#include <boost/test/detail/suppress_warnings.hpp>
21
22//____________________________________________________________________________//
23
24namespace boost {
25namespace test_tools {
26namespace tt_detail {
27
28// ************************************************************************** //
29// ************** backward compatibility support ************** //
30// ************************************************************************** //
31
32template<typename It>
33struct it_pair {
34 typedef It const_iterator;
35 typedef typename std::iterator_traits<It>::value_type value_type;
36
37 it_pair( It const& b, It const& e ) : m_begin( b ), m_size( 0 )
38 {
39 It tmp = b;
40 while( tmp != e ) { ++m_size; ++tmp; }
41 }
42
43 It begin() const { return m_begin; }
44 It end() const { return m_begin + m_size; }
45 size_t size() const { return m_size; }
46
47private:
48 It m_begin;
49 size_t m_size;
50};
51
52//____________________________________________________________________________//
53
54template<typename It>
55it_pair<It>
56make_it_pair( It const& b, It const& e ) { return it_pair<It>( b, e ); }
57
58//____________________________________________________________________________//
59
60template<typename T>
61it_pair<T const*>
62make_it_pair( T const* b, T const* e ) { return it_pair<T const*>( b, e ); }
63
64//____________________________________________________________________________//
65
66} // namespace tt_detail
67} // namespace test_tools
68} // namespace boost
69
70#include <boost/test/detail/enable_warnings.hpp>
71
72#endif // BOOST_TEST_NO_OLD_TOOLS
73
74#endif // BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER
75

source code of include/boost/test/tools/detail/it_pair.hpp