OSDN Git Service

CUDA
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / cuda-6.5 / include / thrust / iterator / detail / discard_iterator_base.h
1 /*
2  *  Copyright 2008-2013 NVIDIA Corporation
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 #pragma once
18
19 #include <thrust/detail/config.h>
20 #include <thrust/iterator/counting_iterator.h>
21 #include <thrust/iterator/iterator_adaptor.h>
22 #include <thrust/iterator/detail/any_assign.h>
23 #include <cstddef> // for std::ptrdiff_t
24
25 namespace thrust
26 {
27
28 // forward declaration of discard_iterator
29 template<typename> class discard_iterator;
30
31 namespace detail
32 {
33
34
35 template<typename System>
36   struct discard_iterator_base
37 {
38   // XXX value_type should actually be void
39   //     but this interferes with zip_iterator<discard_iterator>
40   typedef any_assign         value_type;
41   typedef any_assign&        reference;
42   typedef std::ptrdiff_t     incrementable;
43
44   typedef typename thrust::counting_iterator<
45     incrementable,
46     System,
47     thrust::random_access_traversal_tag
48   > base_iterator;
49
50   typedef typename thrust::iterator_adaptor<
51     discard_iterator<System>,
52     base_iterator,
53     value_type,
54     typename thrust::iterator_system<base_iterator>::type,
55     typename thrust::iterator_traversal<base_iterator>::type,
56     reference
57   > type;
58 }; // end discard_iterator_base
59
60
61 } // end detail
62   
63 } // end thrust
64
65