view: add head/tail accessors that return truncated subviews
This commit is contained in:
parent
3b5197f065
commit
5724de752e
18
view.hpp
18
view.hpp
@ -308,6 +308,24 @@ namespace util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
template <typename IndexT>
|
||||||
|
constexpr auto
|
||||||
|
head (IndexT idx)
|
||||||
|
{
|
||||||
|
return std::get<0> (split (idx));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
template <typename IndexT>
|
||||||
|
constexpr auto
|
||||||
|
tail (IndexT idx)
|
||||||
|
{
|
||||||
|
return std::get<1> (split (idx));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
template <typename IndexT>
|
template <typename IndexT>
|
||||||
[[nodiscard]] constexpr auto
|
[[nodiscard]] constexpr auto
|
||||||
|
Loading…
Reference in New Issue
Block a user