DASH  0.3.0
IteratorTraits.h
1 #ifndef DASH__ITERATOR_TRAITS_H__INCLUDED
2 #define DASH__ITERATOR_TRAITS_H__INCLUDED
3 
4 #include <iterator>
5 #include <type_traits>
6 
7 #include <dash/Meta.h>
8 
9 #include <dash/iterator/GlobIter.h>
10 #include <dash/iterator/GlobViewIter.h>
11 
12 namespace dash {
13 
14 namespace detail {
15 
16 template <typename Iterator>
17 struct is_global_iterator : std::false_type {
18 };
19 
20 template <
21  typename ElementType,
22  class PatternType,
23  class GlobMemType,
24  class PointerType,
25  class ReferenceType>
26 struct is_global_iterator<GlobViewIter<
27  ElementType,
28  PatternType,
29  GlobMemType,
30  PointerType,
31  ReferenceType>> : std::true_type {
32 };
33 
34 template <
35  typename ElementType,
36  class PatternType,
37  class GlobMemType,
38  class PointerType,
39  class ReferenceType>
40 struct is_global_iterator<GlobIter<
41  ElementType,
42  PatternType,
43  GlobMemType,
44  PointerType,
45  ReferenceType>> : std::true_type {
46 };
47 
49 
50 DASH__META__DEFINE_TRAIT__HAS_TYPE(index_type)
51 
52 template <class _Iter, bool = has_type_index_type<_Iter>::value>
53 struct iterator_traits_index_type {
54  typedef typename _Iter::index_type type;
55 };
56 
57 template <class _Iter>
58 struct iterator_traits_index_type<_Iter, false> {
59  typedef dash::default_index_t type;
60 };
61 
62 } // namespace detail
63 
64 template <typename Iterator>
65 struct iterator_traits : std::iterator_traits<Iterator> {
66  using is_global_iterator = typename detail::is_global_iterator<Iterator>;
67  using index_type =
68  typename detail::iterator_traits_index_type<Iterator>::type;
69  using value_type = typename std::iterator_traits<Iterator>::value_type;
70 };
71 
72 } // namespace dash
73 #endif
This class is a simple memory pool which holds allocates elements of size ValueType.
Definition: AllOf.h:8
internal::default_signed_index default_index_t
Signed integer type used as default for index values.
Definition: Types.h:59