Skip to content
Snippets Groups Projects
Commit c7155a06 authored by patavirt's avatar patavirt
Browse files

array: cleanup namespace

parent 5c9b7917
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,6 @@
constexpr size_t Dynamic = SIZE_MAX;
/*! Array dimensions and strides: known at compile-time & dynamic
*/
template <size_t...>
......@@ -55,21 +54,24 @@ struct Shape<Dim0,Dims...>
static constexpr std::array<size_t, ndim> dims() { return {Dim0, Dims...}; }
};
template <size_t I, typename Shape>
struct TailNth;
template <typename Shape>
struct TailNth<0, Shape>
namespace detail
{
using type = Shape;
};
template <size_t I, typename Shape>
struct TailNth
{
using type = typename TailNth<I-1, typename Shape::Tail>::type;
};
/*! Extract Nth tail shape */
template <size_t I, typename Shape>
struct TailNth;
template <typename Shape>
struct TailNth<0, Shape>
{
using type = Shape;
};
template <size_t I, typename Shape>
struct TailNth
{
using type = typename TailNth<I-1, typename Shape::Tail>::type;
};
}
/*! Simple data-by-reference strided array class a la Fortran
*/
......@@ -193,7 +195,7 @@ public:
}
template <typename... Idx>
Array<Scalar, typename TailNth<sizeof...(Idx), Shape>::type > part(Idx... idxs) const
Array<Scalar, typename detail::TailNth<sizeof...(Idx), Shape>::type > part(Idx... idxs) const
{
constexpr size_t nidxs = sizeof...(idxs);
static_assert(nidxs < Shape::ndim,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment