LibRapid / librapid

A highly optimised C++ library for mathematical applications and neural networks.
http://librapid.rtfd.io
MIT License
164 stars 10 forks source link

Rename Storage `begin()` operator #202

Closed Pencilcaseman closed 1 year ago

Pencilcaseman commented 1 year ago

These functions imply suitability as an interator, but this is not the case for the CudaStorage and OpenCLStorage classes.

/// Returns the pointer to the first element of the CudaStorage object
/// \return Pointer to the first element of the CudaStorage object
LIBRAPID_NODISCARD LIBRAPID_ALWAYS_INLINE Pointer begin() const noexcept;

/// Returns the pointer to the last element of the CudaStorage object
/// \return A pointer to the last element of the CudaStorage
LIBRAPID_NODISCARD LIBRAPID_ALWAYS_INLINE Pointer end() const noexcept;

I suggest renaming these functions to be more fitting to their functionality. For example, data() and dataEnd().

begin() and end() should, in the future, be used to support iterator functionality for CPU, GPU and OpenCL types.

Pencilcaseman commented 1 year ago

We can also rename the m_independent property in the storage classes to m_ownsData, which more clearly identifies what it is for. It should be possible to simply rename these since they have equivalent parity.