view: protect functions taking indices with enable_if

This commit is contained in:
Danny Robson 2018-12-16 13:26:13 +11:00
parent 4b3b001d18
commit 44760c6869

View File

@ -276,7 +276,10 @@ namespace cruft {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
template <typename IndexT> template <
typename IndexT,
typename = std::enable_if_t<std::is_integral_v<IndexT>>
>
[[nodiscard]] constexpr auto [[nodiscard]] constexpr auto
split (IndexT idx) const split (IndexT idx) const
{ {
@ -306,7 +309,10 @@ namespace cruft {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
template <typename IndexT> template <
typename IndexT,
typename = std::enable_if_t<std::is_integral_v<IndexT>>
>
constexpr auto constexpr auto
head (IndexT idx) head (IndexT idx)
{ {
@ -315,7 +321,10 @@ namespace cruft {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
template <typename IndexT> template <
typename IndexT,
typename = std::enable_if_t<std::is_integral_v<IndexT>>
>
constexpr auto constexpr auto
tail (IndexT idx) tail (IndexT idx)
{ {
@ -324,7 +333,10 @@ namespace cruft {
//--------------------------------------------------------------------- //---------------------------------------------------------------------
template <typename IndexT> template <
typename IndexT,
typename = std::enable_if_t<std::is_integral_v<IndexT>>
>
[[nodiscard]] constexpr auto [[nodiscard]] constexpr auto
consume (IndexT count) const consume (IndexT count) const
{ {