Skip to content

Commit

Permalink
Changed: gaia.h single header
Browse files Browse the repository at this point in the history
  • Loading branch information
richardbiely committed Sep 23, 2023
1 parent 53a8da5 commit 433b7a2
Showing 1 changed file with 0 additions and 70 deletions.
70 changes: 0 additions & 70 deletions single_include/gaia.h
Original file line number Diff line number Diff line change
Expand Up @@ -8956,76 +8956,6 @@ namespace gaia {
//! Number of items to recycle
size_type m_freeItems = 0;

ImplicitList() noexcept = default;
~ImplicitList() = default;

ImplicitList(size_type count, const_reference value) {
m_items.resize(count);
for (auto it: *this)
*it = value;
}

ImplicitList(size_type count) {
m_items.resize(count);
}

template <typename InputIt>
ImplicitList(InputIt first, InputIt last) {
const auto count = (size_type)GAIA_UTIL::distance(first, last);
m_items.resize(count);

if constexpr (std::is_pointer_v<InputIt>) {
for (size_type i = 0; i < count; ++i)
m_items[i] = first[i];
} else if constexpr (std::is_same_v<
typename InputIt::iterator_category, GAIA_UTIL::random_access_iterator_tag>) {
for (size_type i = 0; i < count; ++i)
m_items[i] = *(first[i]);
} else {
size_type i = 0;
for (auto it = first; it != last; ++it)
m_items[i++] = *it;
}
}

ImplicitList(std::initializer_list<value_type> il): ImplicitList(il.begin(), il.end()) {}

ImplicitList(const ImplicitList& other): ImplicitList(other.begin(), other.end()) {}

ImplicitList(ImplicitList&& other) noexcept:
m_items(std::move(other.m_items)), m_nextFreeIdx(other.m_nextFreeIdx), m_freeItems(other.m_freeItems) {
other.m_nextFreeIdx = (size_type)-1;
other.m_freeItems = 0;
}

ImplicitList& operator=(std::initializer_list<value_type> il) {
*this = darr(il.begin(), il.end());
return *this;
}

ImplicitList& operator=(const ImplicitList& other) {
GAIA_ASSERT(GAIA_UTIL::addressof(other) != this);

m_items = other.m_items;
m_nextFreeIdx = other.m_nextFreeIdx;
m_freeItems = other.m_freeItems;

return *this;
}

ImplicitList& operator=(ImplicitList&& other) noexcept {
GAIA_ASSERT(GAIA_UTIL::addressof(other) != this);

m_items = std::move(other.m_items);
m_nextFreeIdx = other.m_nextFreeIdx;
m_freeItems = other.m_freeItems;

other.m_nextFreeIdx = (size_type)-1;
other.m_freeItems = 0;

return *this;
}

GAIA_NODISCARD pointer data() noexcept {
return (pointer)m_items.data();
}
Expand Down

0 comments on commit 433b7a2

Please sign in to comment.