Skip to content

Commit

Permalink
prepare to update intrusive
Browse files Browse the repository at this point in the history
  • Loading branch information
wjr-z committed Jul 13, 2024
1 parent 7da95e8 commit 76d1684
Show file tree
Hide file tree
Showing 22 changed files with 468 additions and 408 deletions.
352 changes: 155 additions & 197 deletions godbolt/wjr.hpp

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions include/wjr/biginteger/biginteger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class default_biginteger_vector_storage {
using is_reallocatable = std::true_type;

public:
default_biginteger_vector_storage() noexcept = default;
default_biginteger_vector_storage() = default;

default_biginteger_vector_storage(const default_biginteger_vector_storage &) = delete;
default_biginteger_vector_storage(default_biginteger_vector_storage &&) noexcept =
Expand All @@ -131,7 +131,7 @@ class default_biginteger_vector_storage {
default_biginteger_vector_storage &
operator=(default_biginteger_vector_storage &&) noexcept = delete;

~default_biginteger_vector_storage() noexcept = default;
~default_biginteger_vector_storage() = default;

void destroy(_Alty &al) noexcept {
if (WJR_BUILTIN_CONSTANT_P_TRUE(data() == nullptr)) {
Expand Down
36 changes: 18 additions & 18 deletions include/wjr/container/generic/bplus_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ class inline_key {
using reference = std::add_const_t<T> &;
using pointer = std::add_const_t<T> *;

constexpr inline_key() noexcept = default;
constexpr inline_key(const inline_key &other) noexcept = default;
constexpr inline_key(inline_key &&other) noexcept = default;
constexpr inline_key &operator=(const inline_key &other) noexcept = default;
constexpr inline_key &operator=(inline_key &&other) noexcept = default;
~inline_key() noexcept = default;
constexpr inline_key() = default;
constexpr inline_key(const inline_key &other) = default;
constexpr inline_key(inline_key &&other) = default;
constexpr inline_key &operator=(const inline_key &other) = default;
constexpr inline_key &operator=(inline_key &&other) = default;
~inline_key() = default;

constexpr inline_key(reference value) noexcept(
std::is_nothrow_constructible_v<algined_storage<T>, reference>)
Expand All @@ -84,12 +84,12 @@ class inline_key<T, false> {
using reference = std::add_const_t<T> &;
using pointer = std::add_const_t<T> *;

constexpr inline_key() noexcept = default;
constexpr inline_key(const inline_key &other) noexcept = default;
constexpr inline_key(inline_key &&other) noexcept = default;
constexpr inline_key &operator=(const inline_key &other) noexcept = default;
constexpr inline_key &operator=(inline_key &&other) noexcept = default;
~inline_key() noexcept = default;
constexpr inline_key() = default;
constexpr inline_key(const inline_key &other) = default;
constexpr inline_key(inline_key &&other) = default;
constexpr inline_key &operator=(const inline_key &other) = default;
constexpr inline_key &operator=(inline_key &&other) = default;
~inline_key() = default;

constexpr inline_key(reference value) noexcept : m_ptr(std::addressof(value)) {}

Expand Down Expand Up @@ -347,13 +347,13 @@ class bplus_tree_const_iterator {
using pointer = const value_type *;
using reference = const value_type &;

bplus_tree_const_iterator() noexcept = default;
bplus_tree_const_iterator(const bplus_tree_const_iterator &) noexcept = default;
bplus_tree_const_iterator(bplus_tree_const_iterator &&) noexcept = default;
bplus_tree_const_iterator() = default;
bplus_tree_const_iterator(const bplus_tree_const_iterator &) = default;
bplus_tree_const_iterator(bplus_tree_const_iterator &&) = default;
bplus_tree_const_iterator &
operator=(const bplus_tree_const_iterator &) noexcept = default;
bplus_tree_const_iterator &operator=(bplus_tree_const_iterator &&) noexcept = default;
~bplus_tree_const_iterator() noexcept = default;
operator=(const bplus_tree_const_iterator &) = default;
bplus_tree_const_iterator &operator=(bplus_tree_const_iterator &&) = default;
~bplus_tree_const_iterator() = default;

protected:
bplus_tree_const_iterator(const ListNode *list_node, unsigned int pos) noexcept
Expand Down
38 changes: 17 additions & 21 deletions include/wjr/container/generic/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ class default_vector_storage {
using size_ref = default_vector_size_reference<pointer, size_type>;

public:
default_vector_storage() noexcept = default;
default_vector_storage() = default;

default_vector_storage(const default_vector_storage &) = delete;
default_vector_storage(default_vector_storage &&) = delete;
default_vector_storage &operator=(const default_vector_storage &) = delete;
default_vector_storage &operator=(default_vector_storage &&) = delete;

~default_vector_storage() noexcept = default;
~default_vector_storage() = default;

WJR_CONSTEXPR20 void
destroy(_Alty &al) noexcept(std::is_nothrow_destructible_v<value_type>) {
Expand Down Expand Up @@ -271,14 +271,14 @@ class static_vector_storage {
using data_type = Data;

public:
static_vector_storage() noexcept = default;
static_vector_storage() = default;

static_vector_storage(const static_vector_storage &) = delete;
static_vector_storage(static_vector_storage &&) = delete;
static_vector_storage &operator=(const static_vector_storage &) = delete;
static_vector_storage &operator=(static_vector_storage &&) = delete;

~static_vector_storage() noexcept = default;
~static_vector_storage() = default;

WJR_CONSTEXPR20 void
destroy(_Alty &al) noexcept(std::is_nothrow_destructible_v<value_type>) {
Expand Down Expand Up @@ -416,14 +416,14 @@ class fixed_vector_storage {
using size_ref = default_vector_size_reference<pointer, size_type>;

public:
fixed_vector_storage() noexcept = default;
fixed_vector_storage() = default;

fixed_vector_storage(const fixed_vector_storage &) = delete;
fixed_vector_storage(fixed_vector_storage &&) = delete;
fixed_vector_storage &operator=(const fixed_vector_storage &) = delete;
fixed_vector_storage &operator=(fixed_vector_storage &&) = delete;

~fixed_vector_storage() noexcept = default;
~fixed_vector_storage() = default;

private:
WJR_PURE WJR_INTRINSIC_INLINE bool __is_null_data() const {
Expand Down Expand Up @@ -564,14 +564,14 @@ class __sso_vector_storage_impl {
using data_type = Data;

public:
__sso_vector_storage_impl() noexcept = default;
__sso_vector_storage_impl() = default;

__sso_vector_storage_impl(const __sso_vector_storage_impl &) = delete;
__sso_vector_storage_impl(__sso_vector_storage_impl &&) = delete;
__sso_vector_storage_impl &operator=(const __sso_vector_storage_impl &) = delete;
__sso_vector_storage_impl &operator=(__sso_vector_storage_impl &&) = delete;

~__sso_vector_storage_impl() noexcept = default;
~__sso_vector_storage_impl() = default;

WJR_CONSTEXPR20 void
destroy(_Alty &al) noexcept(std::is_nothrow_destructible_v<value_type>) {
Expand Down Expand Up @@ -1015,10 +1015,6 @@ class basic_vector {
return __make_iterator(begin_unsafe());
}

WJR_PURE WJR_CONSTEXPR20 const_iterator cbegin() const noexcept {
return __make_iterator(cbegin_unsafe());
}

WJR_PURE WJR_CONSTEXPR20 iterator end() noexcept {
return __make_iterator(end_unsafe());
}
Expand All @@ -1027,10 +1023,6 @@ class basic_vector {
return __make_iterator(end_unsafe());
}

WJR_PURE WJR_CONSTEXPR20 const_iterator cend() const noexcept {
return __make_iterator(cend_unsafe());
}

WJR_PURE WJR_CONSTEXPR20 reverse_iterator rbegin() noexcept {
return reverse_iterator(end());
}
Expand All @@ -1039,10 +1031,6 @@ class basic_vector {
return const_reverse_iterator(end());
}

WJR_PURE WJR_CONSTEXPR20 const_reverse_iterator crbegin() const noexcept {
return const_reverse_iterator(cend());
}

WJR_PURE WJR_CONSTEXPR20 reverse_iterator rend() noexcept {
return reverse_iterator(begin());
}
Expand All @@ -1051,8 +1039,16 @@ class basic_vector {
return const_reverse_iterator(begin());
}

WJR_PURE WJR_CONSTEXPR20 const_iterator cbegin() const noexcept { return begin(); }

WJR_PURE WJR_CONSTEXPR20 const_iterator cend() const noexcept { return end(); }

WJR_PURE WJR_CONSTEXPR20 const_reverse_iterator crbegin() const noexcept {
return rbegin();
}

WJR_PURE WJR_CONSTEXPR20 const_reverse_iterator crend() const noexcept {
return const_reverse_iterator(cbegin());
return rend();
}

WJR_PURE WJR_CONSTEXPR20 size_type size() const noexcept {
Expand Down
2 changes: 2 additions & 0 deletions include/wjr/container/intrusive/details.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

namespace wjr {

struct default_intrusive_tag {};

template <typename Hook = void, typename Tag = void>
struct intrusive_tag {
using hook_type = Hook;
Expand Down
25 changes: 11 additions & 14 deletions include/wjr/container/intrusive/list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,12 @@ class list_node_const_iterator {
using pointer = const node_type *;
using difference_type = std::ptrdiff_t;

constexpr list_node_const_iterator() noexcept = default;
constexpr list_node_const_iterator(const list_node_const_iterator &) noexcept =
default;
constexpr list_node_const_iterator(list_node_const_iterator &&) noexcept = default;
constexpr list_node_const_iterator() = default;
constexpr list_node_const_iterator(const list_node_const_iterator &) = default;
constexpr list_node_const_iterator(list_node_const_iterator &&) = default;
constexpr list_node_const_iterator &
operator=(const list_node_const_iterator &) noexcept = default;
constexpr list_node_const_iterator &
operator=(list_node_const_iterator &&) noexcept = default;
operator=(const list_node_const_iterator &) = default;
constexpr list_node_const_iterator &operator=(list_node_const_iterator &&) = default;
~list_node_const_iterator() = default;

constexpr list_node_const_iterator(pointer node) noexcept
Expand Down Expand Up @@ -117,12 +115,11 @@ class list_node_iterator : public list_node_const_iterator<T> {

using Mybase::Mybase;

constexpr list_node_iterator() noexcept = default;
constexpr list_node_iterator(const list_node_iterator &) noexcept = default;
constexpr list_node_iterator(list_node_iterator &&) noexcept = default;
constexpr list_node_iterator &
operator=(const list_node_iterator &) noexcept = default;
constexpr list_node_iterator &operator=(list_node_iterator &&) noexcept = default;
constexpr list_node_iterator() = default;
constexpr list_node_iterator(const list_node_iterator &) = default;
constexpr list_node_iterator(list_node_iterator &&) = default;
constexpr list_node_iterator &operator=(const list_node_iterator &) = default;
constexpr list_node_iterator &operator=(list_node_iterator &&) = default;
~list_node_iterator() = default;

constexpr reference operator*() const noexcept {
Expand Down Expand Up @@ -163,7 +160,7 @@ struct list_node {
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;

constexpr list_node() noexcept = default;
constexpr list_node() = default;
list_node(const list_node &) = delete;
list_node(list_node &&) = delete;
list_node &operator=(const list_node &) = delete;
Expand Down
23 changes: 11 additions & 12 deletions include/wjr/container/intrusive/slist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@ class slist_node_const_iterator {
using pointer = const node_type *;
using difference_type = std::ptrdiff_t;

constexpr slist_node_const_iterator() noexcept = default;
constexpr slist_node_const_iterator(const slist_node_const_iterator &) noexcept =
default;
constexpr slist_node_const_iterator(slist_node_const_iterator &&) noexcept = default;
constexpr slist_node_const_iterator() = default;
constexpr slist_node_const_iterator(const slist_node_const_iterator &) = default;
constexpr slist_node_const_iterator(slist_node_const_iterator &&) = default;
constexpr slist_node_const_iterator &
operator=(const slist_node_const_iterator &) noexcept = default;
operator=(const slist_node_const_iterator &) = default;
constexpr slist_node_const_iterator &
operator=(slist_node_const_iterator &&) noexcept = default;
operator=(slist_node_const_iterator &&) = default;
~slist_node_const_iterator() = default;

constexpr slist_node_const_iterator(const node_type *node) noexcept
Expand Down Expand Up @@ -92,12 +91,12 @@ class slist_node_iterator : public slist_node_const_iterator<T> {

using Mybase::Mybase;

constexpr slist_node_iterator() noexcept = default;
constexpr slist_node_iterator(const slist_node_iterator &) noexcept = default;
constexpr slist_node_iterator(slist_node_iterator &&) noexcept = default;
constexpr slist_node_iterator() = default;
constexpr slist_node_iterator(const slist_node_iterator &) = default;
constexpr slist_node_iterator(slist_node_iterator &&) = default;
constexpr slist_node_iterator &
operator=(const slist_node_iterator &) noexcept = default;
constexpr slist_node_iterator &operator=(slist_node_iterator &&) noexcept = default;
operator=(const slist_node_iterator &) = default;
constexpr slist_node_iterator &operator=(slist_node_iterator &&) = default;
~slist_node_iterator() = default;

constexpr reference operator*() const noexcept {
Expand Down Expand Up @@ -129,7 +128,7 @@ struct slist_node {
using iterator = slist_node_iterator<Tag>;
using const_iterator = slist_node_const_iterator<Tag>;

constexpr slist_node() noexcept = default;
constexpr slist_node() = default;
slist_node(const slist_node &) = delete;
slist_node(slist_node &&) = delete;
slist_node &operator=(const slist_node &) = delete;
Expand Down
Loading

0 comments on commit 76d1684

Please sign in to comment.