DASH  0.3.0
Domain.h
1 #ifndef DASH__VIEW__DOMAIN_H__INCLUDED
2 #define DASH__VIEW__DOMAIN_H__INCLUDED
3 
4 #include <dash/Types.h>
5 #include <dash/Range.h>
6 
7 #include <dash/view/ViewTraits.h>
8 
9 
10 namespace dash {
11 
12 // ------------------------------------------------------------------------
13 // dash::domain(View)
14 
19 template <
20  class ViewT,
21  typename ViewValueT = typename std::decay<ViewT>::type >
22 constexpr auto
23 domain(ViewT && view)
24  -> typename std::enable_if<
25  // dash::view_traits<ViewValueT>::is_view::value,
26  dash::detail::has_type_domain_type<ViewValueT>::value,
27  decltype(std::forward<ViewT>(view).domain())
28  >::type {
29  return std::forward<ViewT>(view).domain();
30 }
31 
32 template <class ViewT>
33 constexpr auto
34 domain(const ViewT & view)
35  -> typename std::enable_if<
36  dash::detail::has_type_domain_type<ViewT>::value,
37  // dash::view_traits<ViewT>::is_view::value,
38  decltype(view.domain())
39  // const typename dash::view_traits<ViewT>::domain_type &
40  // const typename ViewT::domain_type &
41  >::type {
42  return view.domain();
43 }
44 
45 // ------------------------------------------------------------------------
46 // dash::domain(Container)
47 
52 template <
53  class ContainerT,
54  typename ContainerValueT = typename std::decay<ContainerT>::type >
55 constexpr typename std::enable_if<
57  !dash::detail::has_type_domain_type<ContainerValueT>::value,
58  ContainerT &
59 >::type
60 domain(ContainerT & container) {
61  return container;
62 }
63 
68 template <
69  class ContainerT,
70  typename ContainerValueT = typename std::decay<ContainerT>::type >
71 constexpr typename std::enable_if<
73  !dash::detail::has_type_domain_type<ContainerValueT>::value,
74  const ContainerT &
75 >::type
76 domain(const ContainerT & container) {
77  return container;
78 }
79 
80 } // namespace dash
81 
82 #endif // DASH__VIEW__DOMAIN_H__INCLUDED
This class is a simple memory pool which holds allocates elements of size ValueType.
Definition: AllOf.h:8
constexpr auto domain(ViewT &&view) -> typename std::enable_if< dash::detail::has_type_domain_type< ViewValueT >::value, decltype(std::forward< ViewT >(view).domain()) >::type
Definition: Domain.h:23