24 #include <boost/mpl/vector_c.hpp>
25 #include <boost/mpl/count.hpp>
38 template< std::ptrdiff_t ... StaticExtents >
42 return boost::hana::count(
43 boost::hana::make_tuple(StaticExtents...),
46 using v = boost::mpl::vector_c<std::ptrdiff_t, StaticExtents...>;
47 using c = boost::mpl::count<v, boost::mpl::integral_c<std::ptrdiff_t, dynamic_extent>>;
60 template<std::ptrdiff_t... StaticExtents>
74 constexpr
auto static_extent_ = std::array<
index_type,
rank()>{StaticExtents...};
75 return std::count(&static_extent_[0], &static_extent_[i+1],
dynamic_extent);
85 template<class... IndexType>
88 { static_assert( 1+
sizeof...(dynamic) ==
rank_dynamic() ,
"" ); }
90 template<
class IndexType>
91 constexpr
extents(
const std::array<IndexType, details::rank_dynamic<StaticExtents...>()>& dynamic) noexcept
96 template<std::ptrdiff_t... OtherExtents>
103 template<std::ptrdiff_t... OtherExtents>
110 static constexpr
size_t rank() noexcept
111 {
return sizeof...(StaticExtents); }
118 constexpr
auto se = std::array<
index_type,
rank()>{StaticExtents...};
119 return k<
rank() ? se[k] : 1;
127 constexpr
auto se = std::array<
index_type,
rank()>{StaticExtents...};
128 return k >=
rank() ? 1
135 template<std::ptrdiff_t... StaticExtentsR>
138 auto const& lhs = *
this;
139 assert(lhs.rank() == rhs.rank());
140 const auto r = lhs.rank();
141 for (std::size_t k=0; k!=r; ++k)
142 if (lhs.extent(k) > rhs.extent(k))
149 template<std::ptrdiff_t... StaticExtentsL, std::ptrdiff_t... StaticExtentsR>
156 const auto r = lhs.
rank();
157 for (std::size_t k=0; k!=r; ++k)
163 template<std::ptrdiff_t... StaticExtentsL, std::ptrdiff_t... StaticExtentsR>
168 return ! (lhs == rhs);
173 #endif // otbExtents_h