Skip to content

Commit

Permalink
add Doxygen comments for C-style array constructor and as<T>() method…
Browse files Browse the repository at this point in the history
… in buffer_view
  • Loading branch information
farukeryilmaz committed Jan 10, 2024
1 parent b7da265 commit af8201f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/bytepack/bytepack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ concept ValidBufferAccessType = sizeof(T) == 1 || std::is_void_v<T>;
class buffer_view
{
public:
/**
* @brief Constructs a buffer_view from a C-style array.
*
* @tparam T The type of elements in the array.
* @tparam N The number of elements in the array.
* @param array Reference to the array.
*/
template<typename T, std::size_t N>
requires SerializableBuffer<T>
explicit constexpr buffer_view(T (&array)[N]) noexcept
Expand Down Expand Up @@ -85,6 +92,12 @@ class buffer_view
: data_{ ptr }, size_{ size }, ssize_{ to_ssize(size) }
{}

/**
* @brief Returns a typed pointer to the buffer data.
*
* @tparam T The type to cast the data pointer to.
* @return T* Typed pointer to the buffer data.
*/
template<typename T>
requires ValidBufferAccessType<T>
[[nodiscard]] constexpr T* as() const noexcept
Expand Down

0 comments on commit af8201f

Please sign in to comment.