2018-01-09 11:37:26 +01:00
|
|
|
|
|
|
|
#ifndef __for_utils_h__
|
|
|
|
#define __for_utils_h__
|
|
|
|
|
|
|
|
#include "ranges/rheader.h"
|
|
|
|
#include <array>
|
|
|
|
#include <tuple>
|
|
|
|
|
|
|
|
namespace MultiArrayHelper
|
|
|
|
{
|
|
|
|
namespace {
|
|
|
|
template <class Op>
|
|
|
|
using to_size_t = size_t;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <size_t N>
|
|
|
|
struct XFPackNum
|
|
|
|
{
|
2018-01-13 18:07:52 +01:00
|
|
|
template <class ETuple, typename... Args>
|
|
|
|
static ETuple mkPos(size_t pos, const ETuple& et, const ETuple& lt, const Args&... args)
|
2018-01-09 11:37:26 +01:00
|
|
|
{
|
2018-01-13 18:07:52 +01:00
|
|
|
return std::move( XFPackNum<N-1>::mkPos(pos, et, lt, std::get<N>(lt) + pos * std::get<N>(et), args...) );
|
2018-01-09 11:37:26 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct XFPackNum<0>
|
|
|
|
{
|
2018-01-13 18:07:52 +01:00
|
|
|
template <class ETuple, typename... Args>
|
|
|
|
static ETuple mkPos(size_t pos, const ETuple& et, const ETuple& lt, const Args&... args)
|
2018-01-09 11:37:26 +01:00
|
|
|
{
|
2018-01-13 18:07:52 +01:00
|
|
|
return ETuple(std::get<0>(lt) + pos * std::get<0>(et), args...);
|
2018-01-09 11:37:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace MultiArrayHelper
|
|
|
|
|
|
|
|
#endif
|