Replacing std::format with fmt::format

This commit is contained in:
Dynamitos
2024-01-16 19:24:49 +01:00
parent c0da7d77a1
commit 861c146b46
55 changed files with 304 additions and 186 deletions
+6 -10
View File
@@ -38,14 +38,14 @@ public:
{
return p;
}
constexpr bool operator!=(const IteratorBase &other) const
{
return p != other.p;
}
constexpr bool operator==(const IteratorBase &other) const
{
return p == other.p;
}
constexpr std::strong_ordering operator<=>(const IteratorBase &other) const
{
return p <=> other.p;
}
constexpr IteratorBase operator+(size_t other) const
{
IteratorBase tmp(*this);
@@ -61,10 +61,6 @@ public:
p+=other;
return *this;
}
constexpr bool operator<(const IteratorBase& other) const
{
return p < other.p;
}
constexpr IteratorBase operator-(difference_type diff) const
{
return IteratorBase(p - diff);
@@ -537,7 +533,7 @@ public:
assert(index < arraySize);
return _data[index];
}
constexpr const reference operator[](size_type index) const
constexpr const_reference operator[](size_type index) const
{
assert(index < arraySize);
return _data[index];
@@ -674,7 +670,7 @@ constexpr bool operator==(const Array<Type, Alloc> &lhs, const Array<Type, Alloc
template<class Type, class Alloc>
constexpr auto operator<=>(const Array<Type, Alloc>& lhs, const Array<Type, Alloc>& rhs)
{
return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
template <typename T, size_t N>
+24 -9
View File
@@ -1,5 +1,6 @@
#pragma once
#include <memory_resource>
#include <assert.h>
namespace Seele
{
@@ -9,6 +10,16 @@ class List
private:
struct Node
{
Node(Node* prev, Node* next, const T& data)
: prev(prev)
, next(next)
, data(std::move(data))
{}
Node(Node* prev, Node* next, T&& data)
: prev(prev)
, next(next)
, data(std::move(data))
{}
Node *prev;
Node *next;
T data;
@@ -57,39 +68,43 @@ public:
}
return *this;
}
reference operator*() const
constexpr reference operator*() const
{
return node->data;
}
pointer operator->() const
constexpr pointer operator->() const
{
return &node->data;
}
inline bool operator!=(const IteratorBase &other)
constexpr bool operator!=(const IteratorBase &other)
{
return node != other.node;
}
inline bool operator==(const IteratorBase &other)
constexpr bool operator==(const IteratorBase &other)
{
return node == other.node;
}
IteratorBase &operator--()
constexpr std::strong_ordering operator<=>(const IteratorBase& other)
{
return node <=> other.node;
}
constexpr IteratorBase &operator--()
{
node = node->prev;
return *this;
}
IteratorBase operator--(int)
constexpr IteratorBase operator--(int)
{
IteratorBase tmp(*this);
--*this;
return tmp;
}
IteratorBase &operator++()
constexpr IteratorBase &operator++()
{
node = node->next;
return *this;
}
IteratorBase operator++(int)
constexpr IteratorBase operator++(int)
{
IteratorBase tmp(*this);
++*this;
@@ -187,7 +202,7 @@ public:
, beginIt(std::move(other.beginIt))
, endIt(std::move(other.endIt))
, _size(std::move(other._size))
, allocator(allocator)
, allocator(alloc)
{
other._size = 0;
}
+21 -7
View File
@@ -15,6 +15,16 @@ struct Tree
protected:
struct Node
{
Node(Node* left, Node* right, const NodeData& nodeData)
: leftChild(left)
, rightChild(right)
, data(nodeData)
{}
Node(Node* left, Node* right, NodeData&& nodeData)
: leftChild(left)
, rightChild(right)
, data(std::move(nodeData))
{}
Node* leftChild;
Node* rightChild;
NodeData data;
@@ -71,12 +81,16 @@ public:
}
constexpr bool operator!=(const IteratorBase& other)
{
return node != other.node;
return node == other.node;
}
constexpr bool operator==(const IteratorBase& other)
{
return node == other.node;
}
constexpr std::strong_ordering operator<=>(const IteratorBase& other)
{
return node == other.node;
}
constexpr IteratorBase& operator++()
{
node = node->rightChild;
@@ -433,8 +447,8 @@ private:
_size++;
return Pair<Node*, bool>(newNode, true);
}
template<class KeyType>
Node* _remove(Node* r, KeyType&& key)
template<class K>
Node* _remove(Node* r, K&& key)
{
markIteratorsDirty();
Node* temp;
@@ -463,8 +477,8 @@ private:
_size--;
return r;
}
template<class KeyType>
Node* _splay(Node* r, KeyType&& key)
template<class K>
Node* _splay(Node* r, K&& key)
{
markIteratorsDirty();
if (r == nullptr || equal(r->data, key))
@@ -516,8 +530,8 @@ private:
return (r->rightChild == nullptr) ? r : rotateLeft(r);
}
}
template<typename KeyType>
bool equal(const NodeData& a, KeyType&& b) const
template<typename K>
bool equal(const NodeData& a, K&& b) const
{
return !comp(keyFun(a), b) && !comp(b, keyFun(a));
}