Bolt  1.3
C++ template library with support for OpenCL
iterator_traits.h
Go to the documentation of this file.
1 /***************************************************************************
2 * © 2012,2014 Advanced Micro Devices, Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 
16 ***************************************************************************/
17 
18 #pragma once
19 #if !defined( BOLT_AMP_ITERATOR_TRAITS_H )
20 #define BOLT_AMP_ITERATOR_TRAITS_H
21 
28 namespace bolt {
29 namespace amp {
30 
31 
32  template< typename iterator >
34  {
35  typedef typename iterator::iterator_category iterator_category;
36  typedef typename iterator::value_type value_type;
37  typedef typename iterator::difference_type difference_type;
38  typedef typename iterator::pointer pointer;
39  typedef typename iterator::reference reference;
40  };
41 
42  template< class T >
43  struct iterator_traits< T* >
44  {
45  typedef typename std::random_access_iterator_tag iterator_category;
46  typedef T value_type;
47  // difference_type set to int for OpenCL backend
48  typedef int difference_type;
49  typedef T* pointer;
50  typedef T& reference;
51  };
52 
53  template< class T >
54  struct iterator_traits< const T* >
55  {
56  typedef typename std::random_access_iterator_tag iterator_category;
57  typedef T value_type;
58  typedef int difference_type;
59  typedef const T* pointer;
60  typedef const T& reference;
61  };
62 
63  struct fancy_iterator_tag: public std::random_access_iterator_tag
64  {
65 
66  };
67 
68 
69 
70 }
71 };
72 
73 #endif