Skip to content

Commit

Permalink
Complete interface of llama::Array<T, 0>
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Jan 31, 2023
1 parent 6624ee6 commit f55f1c8
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions include/llama/Array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,38 @@ namespace llama
return nullptr;
}

LLAMA_FN_HOST_ACC_INLINE constexpr auto front() -> T&
{
outOfRange();
}

LLAMA_FN_HOST_ACC_INLINE constexpr auto front() const -> const T&
{
outOfRange();
}

LLAMA_FN_HOST_ACC_INLINE constexpr auto back() -> T&
{
outOfRange();
}

LLAMA_FN_HOST_ACC_INLINE constexpr auto back() const -> const T&
{
outOfRange();
}

template<typename IndexType>
LLAMA_FN_HOST_ACC_INLINE constexpr auto operator[](IndexType&&) -> T&
{
outOfRange();
}

template<typename IndexType>
LLAMA_FN_HOST_ACC_INLINE constexpr auto operator[](IndexType&&) const -> const T&
{
outOfRange();
}

LLAMA_FN_HOST_ACC_INLINE constexpr auto data() -> T*
{
return nullptr;
Expand All @@ -185,6 +217,24 @@ namespace llama
{
return {};
}

template<std::size_t I>
LLAMA_FN_HOST_ACC_INLINE constexpr auto get() -> T&
{
outOfRange();
}

template<std::size_t I>
LLAMA_FN_HOST_ACC_INLINE constexpr auto get() const -> const T&
{
outOfRange();
}

private:
[[noreturn]] void outOfRange() const
{
throw std::out_of_range{"Array has zero length"};
}
};

template<typename First, typename... Args>
Expand Down

0 comments on commit f55f1c8

Please sign in to comment.