view: add head/tail accessors that return truncated subviews

This commit is contained in:
Danny Robson 2018-08-01 13:09:15 +10:00
parent 3b5197f065
commit 5724de752e

View File

@ -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