]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/test/tools/detail/it_pair.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / test / tools / detail / it_pair.hpp
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
24 namespace boost {
25 namespace test_tools {
26 namespace tt_detail {
27
28 // ************************************************************************** //
29 // ************** backward compatibility support ************** //
30 // ************************************************************************** //
31
32 template<typename It>
33 struct 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
47 private:
48 It m_begin;
49 size_t m_size;
50 };
51
52 //____________________________________________________________________________//
53
54 template<typename It>
55 it_pair<It>
56 make_it_pair( It const& b, It const& e ) { return it_pair<It>( b, e ); }
57
58 //____________________________________________________________________________//
59
60 template<typename T>
61 it_pair<T const*>
62 make_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