2018-01-09 11:37:26 +01:00
|
|
|
|
|
|
|
#ifndef __for_utils_h__
|
|
|
|
#define __for_utils_h__
|
|
|
|
|
2018-09-12 17:05:27 +02:00
|
|
|
//#include "ranges/rheader.h"
|
2018-01-09 11:37:26 +01:00
|
|
|
#include <array>
|
|
|
|
#include <tuple>
|
|
|
|
|
2021-07-28 20:29:56 +02:00
|
|
|
namespace CNORXZInternal
|
2018-01-09 11:37:26 +01:00
|
|
|
{
|
|
|
|
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>
|
2018-01-18 23:14:49 +01:00
|
|
|
static inline 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>
|
2018-01-18 23:14:49 +01:00
|
|
|
static inline 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
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2021-07-28 20:29:56 +02:00
|
|
|
} // end namespace CNORXZInternal
|
2018-01-09 11:37:26 +01:00
|
|
|
|
|
|
|
#endif
|