1 | // Boost.Range library
|
---|
2 | //
|
---|
3 | // Copyright Thorsten Ottosen 2003-2004. Use, modification and
|
---|
4 | // distribution is subject to the Boost Software License, Version
|
---|
5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
---|
6 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
7 | //
|
---|
8 | // For more information, see http://www.boost.org/libs/range/
|
---|
9 | //
|
---|
10 |
|
---|
11 | #if !defined( BOOST_RANGE_DETAIL_MFC_CARRAY_HPP ) && defined( BOOST_RANGE_ENABLE_MCF_CARRAY )
|
---|
12 | #define BOOST_RANGE_DETAIL_MFC_CARRAY_HPP
|
---|
13 |
|
---|
14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
---|
15 | # pragma once
|
---|
16 | #endif
|
---|
17 |
|
---|
18 | #include <afxtempl.h> // for CArray
|
---|
19 | #include <boost/range/config.hpp>
|
---|
20 | #include <boost/range/metafunctions.hpp>
|
---|
21 |
|
---|
22 | namespace boost
|
---|
23 | {
|
---|
24 | template< class T, class U >
|
---|
25 | struct range_iterator< CArray<T,U> >
|
---|
26 | {
|
---|
27 | typedef T* type;
|
---|
28 | };
|
---|
29 |
|
---|
30 | //
|
---|
31 | // Why is this needed?!?
|
---|
32 | //
|
---|
33 | template< class T, class U >
|
---|
34 | struct range_iterator< const CArray<T,U> >
|
---|
35 | {
|
---|
36 | typedef T* type;
|
---|
37 | };
|
---|
38 |
|
---|
39 | template< class T, class U >
|
---|
40 | struct range_const_iterator< CArray<T,U> >
|
---|
41 | {
|
---|
42 | typedef const T* type;
|
---|
43 | };
|
---|
44 |
|
---|
45 | template< class T, class U >
|
---|
46 | struct range_difference< CArray<T,U> >
|
---|
47 | {
|
---|
48 | typedef std::ptrdiff_t type;
|
---|
49 | };
|
---|
50 |
|
---|
51 | template< class T, class U >
|
---|
52 | struct range_size< CArray<T,U> >
|
---|
53 | {
|
---|
54 | typedef int type;
|
---|
55 | };
|
---|
56 |
|
---|
57 | template< class T, class U >
|
---|
58 | struct range_value< CArray<T,U> >
|
---|
59 | {
|
---|
60 | typedef T type;
|
---|
61 | };
|
---|
62 |
|
---|
63 | template< class T, class U >
|
---|
64 | T* boost_range_begin( CArray<T,U>& r )
|
---|
65 | {
|
---|
66 | return r.GetData();
|
---|
67 | }
|
---|
68 |
|
---|
69 | template< class T, class U >
|
---|
70 | const T* boost_range_begin( const CArray<T,U>& r )
|
---|
71 | {
|
---|
72 | return r.GetData();
|
---|
73 | }
|
---|
74 |
|
---|
75 | template< class T, class U >
|
---|
76 | int boost_range_size( const CArray<T,U>& r )
|
---|
77 | {
|
---|
78 | return r.GetSize();
|
---|
79 | }
|
---|
80 |
|
---|
81 | template< class T, class U >
|
---|
82 | T* boost_range_end( CArray<T,U>& r )
|
---|
83 | {
|
---|
84 | return boost_range_begin( r ) + boost_range_size( r );
|
---|
85 | }
|
---|
86 |
|
---|
87 | template< class T, class U >
|
---|
88 | const T* boost_range_end( const CArray<T,U>& r )
|
---|
89 | {
|
---|
90 | return boost_range_begin( r ) + boost_range_size( r );
|
---|
91 | }
|
---|
92 |
|
---|
93 | // default 'empty()' ok
|
---|
94 |
|
---|
95 | } // namespace 'boost'
|
---|
96 |
|
---|
97 | #endif
|
---|