7 #ifndef ROSETTASTONE_UTILS_HPP 8 #define ROSETTASTONE_UTILS_HPP 18 template <
typename T,
typename... Others>
77 for (
size_t i = 0; i < m_size; ++i)
94 for (std::size_t i = 0; i < m_size; ++i)
104 reset(ptr.get(), ptr.size());
115 if (m_ptr !=
nullptr)
129 if (m_ptr !=
nullptr)
141 return m_ptr !=
nullptr;
200 if (m_size != other.
size())
205 for (std::size_t i = 0; i < m_size; ++i)
207 if (m_ptr[i] != other[i])
228 return m_ptr ==
nullptr;
235 return m_ptr !=
nullptr;
263 return m_ptr + m_size;
270 return m_ptr + m_size;
277 return m_ptr + m_size;
285 #endif // ROSETTASTONE_UTILS_HPP T * pointer
Definition: Utils.hpp:41
bool operator!=(std::nullptr_t) const
Definition: Utils.hpp:233
bool operator==(const SizedPtr &other) const
Definition: Utils.hpp:198
~SizedPtr()
Default destructor.
Definition: Utils.hpp:69
SizedPtr class.
Definition: Utils.hpp:32
constexpr bool AllCondIsTrue(const T &t)
Definition: Utils.hpp:13
iterator begin()
Definition: Utils.hpp:240
void reset() noexcept
Resets buffer.
Definition: Utils.hpp:113
T & reference
Definition: Utils.hpp:38
std::size_t size_type
Definition: Utils.hpp:36
std::size_t size() const
Definition: Utils.hpp:160
const_iterator cend() const
Definition: Utils.hpp:275
SizedPtr(SizedPtr &&ptr) noexcept
Move constructor.
Definition: Utils.hpp:84
T & operator[](std::size_t idx)
Definition: Utils.hpp:182
pointer iterator
Definition: Utils.hpp:44
const_iterator end() const
Definition: Utils.hpp:268
SizedPtr(std::size_t size)
Definition: Utils.hpp:55
const_iterator begin() const
Definition: Utils.hpp:247
void reset(T *other, std::size_t size) noexcept
Definition: Utils.hpp:127
const_iterator cbegin() const
Definition: Utils.hpp:254
const T * const_pointer
Definition: Utils.hpp:42
iterator end()
Definition: Utils.hpp:261
const T & operator*() const
Definition: Utils.hpp:174
SizedPtr(T *ptr, std::size_t size)
Definition: Utils.hpp:63
T & operator*()
Definition: Utils.hpp:167
SizedPtr()
Default constructor.
Definition: Utils.hpp:48
SizedPtr(const SizedPtr &ptr)
Copy constructor, deep copying buffer.
Definition: Utils.hpp:75
bool operator!=(const SizedPtr &other) const
Definition: Utils.hpp:219
const T & operator[](std::size_t idx) const
Definition: Utils.hpp:190
const T & const_reference
Definition: Utils.hpp:39
const_pointer const_iterator
Definition: Utils.hpp:45
bool operator==(std::nullptr_t) const
Definition: Utils.hpp:226
T value_type
Definition: Utils.hpp:35
SizedPtr & operator=(const SizedPtr &ptr)
Copy assignment operator, deep copying buffer.
Definition: Utils.hpp:91
SizedPtr & operator=(SizedPtr &&ptr) noexcept
Move assignment operator.
Definition: Utils.hpp:102