#pragma once
|
|
#include <stddef.h>
|
|
|
|
namespace cl
|
|
{
|
|
template<typename a, typename ...b>
|
|
class tuple{
|
|
a _mine;
|
|
tuple<b...> _child;
|
|
template<size_t idx, a, b...>
|
|
friend a get();
|
|
public:
|
|
tuple(a mine, b ...child)
|
|
: _mine(mine)
|
|
, _child(child...)
|
|
{}
|
|
};
|
|
|
|
|
|
template<size_t idx, typename ...a>
|
|
constexpr auto get(tuple<a...> v)
|
|
{
|
|
if constexpr (idx!=0)
|
|
return get<idx-1>(v._child);
|
|
else
|
|
return v._mine;
|
|
}
|
|
}
|