maps dont work

This commit is contained in:
Dynamitos
2025-03-25 09:17:08 +01:00
parent e7ba74e258
commit a91aeab309
10 changed files with 103 additions and 118 deletions
+1 -1
View File
@@ -140,7 +140,7 @@ target_compile_options(Engine PUBLIC "$<$<CONFIG:DEBUG>:-DENABLE_VALIDATION>")
target_compile_options(Engine PUBLIC "$<$<CONFIG:DEBUG>:-DSEELE_DEBUG>")
add_subdirectory(src/)
#add_subdirectory(tests/)
add_subdirectory(tests/)
if(WIN32)
add_custom_target(dll_copy ALL
+6
View File
@@ -7,6 +7,12 @@
#include "MeshAsset.h"
#include "SVGAsset.h"
#include "TextureAsset.h"
#include "Asset/TextureAsset.h"
#include "Asset/FontAsset.h"
#include "Asset/SVGAsset.h"
#include "Asset/MeshAsset.h"
#include "Asset/MaterialAsset.h"
#include "Asset/MaterialInstanceAsset.h"
#include "Window/WindowManager.h"
#include <fstream>
#include <iostream>
+4 -4
View File
@@ -88,7 +88,7 @@ template <typename T> struct Array {
_data = allocateArray(DEFAULT_ALLOC_SIZE);
assert(_data != nullptr);
}
constexpr Array(size_type size, const value_type& value, const allocator_type& alloc = allocator_type())
constexpr Array(size_type size, const value_type& value, const allocator_type& alloc = allocator_type(debug_resource::get("Array")))
: arraySize(size), allocated(size), allocator(alloc) {
_data = allocateArray(size);
assert(_data != nullptr);
@@ -96,7 +96,7 @@ template <typename T> struct Array {
std::allocator_traits<allocator_type>::construct(allocator, &_data[i], value);
}
}
constexpr explicit Array(size_type size, const allocator_type& alloc = allocator_type())
constexpr explicit Array(size_type size, const allocator_type& alloc = allocator_type(debug_resource::get("Array")))
: arraySize(size), allocated(size), allocator(alloc) {
_data = allocateArray(size);
assert(_data != nullptr);
@@ -108,14 +108,14 @@ template <typename T> struct Array {
}
}
}
constexpr Array(std::initializer_list<T> init, const allocator_type& alloc = allocator_type())
constexpr Array(std::initializer_list<T> init, const allocator_type& alloc = allocator_type(debug_resource::get("Array")))
: arraySize(init.size()), allocated(init.size()), allocator(alloc) {
_data = allocateArray(init.size());
assert(_data != nullptr);
std::uninitialized_copy(init.begin(), init.end(), begin());
}
template <container_compatible_range<T> Range>
constexpr Array(std::from_range_t, Range&& rg, const allocator_type& alloc = allocator_type())
constexpr Array(std::from_range_t, Range&& rg, const allocator_type& alloc = allocator_type(debug_resource::get("Array")))
: arraySize(0), allocated(0), allocator(alloc) {
if constexpr (std::ranges::sized_range<Range> || std::ranges::forward_range<Range>) {
arraySize = std::ranges::size(rg);
+16 -13
View File
@@ -4,31 +4,34 @@
using namespace Seele;
std::mutex allocationMutex;
std::map<std::string, std::atomic_uint64_t> allocationCounters;
std::mutex resourcesMutex;
std::map<std::string, debug_resource> debugResources;
std::atomic_uint64_t& MemoryManager::getAllocationCounter(const std::string& name) {
std::unique_lock l(allocationMutex);
return allocationCounters[name];
std::unique_lock l(getInstance().allocationMutex);
return getInstance().allocationCounters[name];
}
void MemoryManager::printAllocations() {
std::unique_lock l(allocationMutex);
for (const auto& [name, counter] : allocationCounters) {
if (name.empty())
{
std::unique_lock l(getInstance().allocationMutex);
for (const auto& [name, counter] : getInstance().allocationCounters) {
if (name.empty()) {
std::cout << name << ": " << counter << std::endl;
}
else
{
} else {
std::cout << name << ": " << counter << std::endl;
}
}
}
MemoryManager& MemoryManager::getInstance() {
static MemoryManager instance;
return instance;
}
debug_resource* debug_resource::get(const std::string& name) {
static std::mutex resourcesMutex;
static std::map<std::string, debug_resource> debugResources;
std::unique_lock l(resourcesMutex);
if (!debugResources.count(name)) {
debugResources.emplace(std::pair(name, debug_resource(name)));
}
return &debugResources[name];
}
+6
View File
@@ -1,5 +1,6 @@
#pragma once
#include <memory_resource>
#include <map>
namespace Seele {
class MemoryManager {
@@ -8,6 +9,9 @@ class MemoryManager {
static void printAllocations();
private:
static MemoryManager& getInstance();
std::mutex allocationMutex;
std::map<std::string, std::atomic_uint64_t> allocationCounters;
};
class debug_resource : public std::pmr::memory_resource {
@@ -17,7 +21,9 @@ class debug_resource : public std::pmr::memory_resource {
debug_resource(std::string name, std::pmr::memory_resource* up = std::pmr::get_default_resource())
: name(name), upstream(up), counter(MemoryManager::getAllocationCounter(name)) {}
debug_resource(const debug_resource& other) = delete;
debug_resource(debug_resource&& other) = default;
debug_resource& operator=(const debug_resource& other) = delete;
debug_resource& operator=(debug_resource&& other) = default;
void* do_allocate(size_t bytes, size_t alignment) override {
counter += bytes;
+48 -58
View File
@@ -1,23 +1,17 @@
#pragma once
#include "Array.h"
#include "List.h"
#include "Pair.h"
#include <map>
#include <memory_resource>
#include <memory>
namespace Seele {
template <typename KeyType, typename NodeData, typename KeyFun, typename Compare, typename Allocator> struct Tree {
protected:
struct Node {
Node(const NodeData& data)
: data(data)
{}
Node(NodeData&& data)
: data(std::move(data)) {}
Node(const NodeData& data) : data(data) {}
Node(NodeData&& data) : data(std::move(data)) {}
Node* parent = nullptr;
Node* leftChild;
Node* rightChild;
Node* leftChild = nullptr;
Node* rightChild = nullptr;
NodeData data;
};
using NodeAlloc = std::allocator_traits<Allocator>::template rebind_alloc<Node>;
@@ -41,7 +35,7 @@ template <typename KeyType, typename NodeData, typename KeyFun, typename Compare
using pointer = const_pointer;
using reference = const value_type&;
constexpr ConstIterator(Node* x = nullptr) : node(x) {}
constexpr ConstIterator(Node* x, List<Node*>&& traversal) : node(x), traversal(std::move(traversal)) {}
constexpr ConstIterator(const ConstIterator& i) = default;
constexpr ConstIterator(ConstIterator&& i) noexcept = default;
constexpr ConstIterator& operator=(const ConstIterator& other) = default;
@@ -52,22 +46,30 @@ template <typename KeyType, typename NodeData, typename KeyFun, typename Compare
constexpr bool operator!=(const ConstIterator& other) { return node != other.node; }
constexpr std::strong_ordering operator<=>(const ConstIterator& other) { return node <=> other.node; }
constexpr ConstIterator& operator++() noexcept {
node = node->rightChild;
while (node != nullptr && node->leftChild != nullptr) {
node = node->leftChild;
// walk up tree until we can go a single step to the right
while (traversal.size() > 0 && node->rightChild == nullptr) {
node = traversal.back();
traversal.popBack();
}
if (node == nullptr && node->parent != nullptr) {
node = node->parent;
// if there is a right subtree we havent visited yet
if (node->rightChild != nullptr) {
// go that single step
node = node->rightChild;
// then to the leftmost node of that right subtree
while (node->leftChild != nullptr) {
node = node->leftChild;
}
}
return *this;
}
constexpr ConstIterator& operator--() {
node = node->leftChild;
while (node != nullptr && node->rightChild != nullptr) {
node = node->rightchild;
while (node->leftChild == nullptr) {
node = traversal.back();
traversal.popBack();
}
if (node == nullptr && node->parent != nullptr) {
node = node->parent;
node = node->leftChild;
while (node->rightChild != nullptr) {
node = node->rightChild;
}
return *this;
}
@@ -86,6 +88,7 @@ template <typename KeyType, typename NodeData, typename KeyFun, typename Compare
protected:
Node* node;
List<Node*> traversal;
};
class Iterator : public ConstIterator {
@@ -95,7 +98,7 @@ template <typename KeyType, typename NodeData, typename KeyFun, typename Compare
using pointer = pointer;
using reference = value_type&;
constexpr Iterator(Node* x = nullptr) : ConstIterator(x) {}
constexpr Iterator(Node* x, List<Node*>&& traversal) : ConstIterator(x, std::move(traversal)) {}
constexpr Iterator(const Iterator& i) = default;
constexpr Iterator(Iterator&& i) noexcept = default;
constexpr Iterator& operator=(const Iterator& other) = default;
@@ -128,25 +131,26 @@ template <typename KeyType, typename NodeData, typename KeyFun, typename Compare
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
constexpr Tree() noexcept
: alloc(NodeAlloc()), root(nullptr), beginIt(nullptr), endIt(nullptr), iteratorsDirty(true), _size(0), comp(Compare()) {}
: alloc(NodeAlloc()), root(nullptr), beginIt(nullptr, {}), endIt(nullptr, {}), iteratorsDirty(true), _size(0), comp(Compare()) {}
constexpr explicit Tree(const Compare& comp, const Allocator& alloc = Allocator()) noexcept(noexcept(Allocator()))
: alloc(alloc), root(nullptr), beginIt(nullptr), endIt(nullptr), iteratorsDirty(true), _size(0), comp(comp) {}
: alloc(alloc), root(nullptr), beginIt(nullptr, {}), endIt(nullptr, {}), iteratorsDirty(true), _size(0), comp(comp) {}
constexpr explicit Tree(const Allocator& alloc) noexcept(noexcept(Compare()))
: alloc(alloc), root(nullptr), beginIt(nullptr), endIt(nullptr), iteratorsDirty(true), _size(0), comp(Compare()) {}
: alloc(alloc), root(nullptr), beginIt(nullptr, {}), endIt(nullptr, {}), iteratorsDirty(true), _size(0), comp(Compare()) {}
constexpr Tree(std::initializer_list<NodeData> init)
: alloc(NodeAlloc()), root(nullptr), beginIt(nullptr), endIt(nullptr), iteratorsDirty(true), _size(0), comp(Compare()) {
: alloc(NodeAlloc()), root(nullptr), beginIt(nullptr, {}), endIt(nullptr, {}), iteratorsDirty(true), _size(0), comp(Compare()) {
for (const auto& it : init) {
insert(it);
}
}
constexpr Tree(const Tree& other) : alloc(other.alloc), root(nullptr), iteratorsDirty(true), _size(), comp(other.comp) {
constexpr Tree(const Tree& other)
: alloc(other.alloc), root(nullptr), beginIt(nullptr, {}), endIt(nullptr, {}), iteratorsDirty(true), _size(), comp(other.comp) {
for (const auto& elem : other) {
insert(elem);
}
}
constexpr Tree(Tree&& other) noexcept
: alloc(std::move(other.alloc)), root(std::move(other.root)), iteratorsDirty(true), _size(std::move(other._size)),
comp(std::move(other.comp)) {
: alloc(std::move(other.alloc)), root(std::move(other.root)), beginIt(nullptr, {}), endIt(nullptr, {}), iteratorsDirty(true),
_size(std::move(other._size)), comp(std::move(other.comp)) {
other._size = 0;
}
constexpr ~Tree() noexcept { clear(); }
@@ -217,7 +221,7 @@ template <typename KeyType, typename NodeData, typename KeyFun, typename Compare
if (root == nullptr || !equal(root->data, key)) {
return end();
}
return iterator(root);
return iterator(root, {});
}
constexpr iterator find(const key_type& key) const {
Node* it = root;
@@ -231,21 +235,21 @@ template <typename KeyType, typename NodeData, typename KeyFun, typename Compare
if (it == nullptr) {
return end();
}
return iterator(it);
return iterator(it, {});
}
constexpr Pair<iterator, bool> insert(const NodeData& data) {
const auto& [r, inserted] = _insert(root, data);
root = r;
return Pair<iterator, bool>(iterator(root), inserted);
return Pair<iterator, bool>(iterator(root, {}), inserted);
}
constexpr Pair<iterator, bool> insert(NodeData&& data) {
const auto& [r, inserted] = _insert(root, std::move(data));
root = r;
return Pair<iterator, bool>(iterator(root), inserted);
return Pair<iterator, bool>(iterator(root, {}), inserted);
}
constexpr iterator remove(const key_type& key) {
root = _remove(root, key);
return iterator(root);
return iterator(root, {});
}
private:
@@ -263,21 +267,22 @@ template <typename KeyType, typename NodeData, typename KeyFun, typename Compare
iteratorsDirty = false;
}
constexpr Iterator calcBeginIterator() const {
Node* begin = root;
while (begin != nullptr) {
begin = begin->leftChild;
Node* beginNode = root;
List<Node*> traversal;
while (beginNode->leftChild != nullptr) {
traversal.add(beginNode);
beginNode = beginNode->leftChild;
}
if (begin->parent != nullptr) {
begin = begin->parent;
}
return Iterator(begin);
return Iterator(beginNode, std::move(traversal));
}
constexpr Iterator calcEndIterator() const {
Node* endNode = root;
List<Node*> traversal;
while (endNode != nullptr) {
traversal.add(endNode);
endNode = endNode->rightChild;
}
return Iterator(endNode);
return Iterator(endNode, std::move(traversal));
}
NodeAlloc alloc;
Node* root;
@@ -290,17 +295,13 @@ template <typename KeyType, typename NodeData, typename KeyFun, typename Compare
Node* rotateLeft(Node* x) {
Node* y = x->rightChild;
x->rightChild = y->leftChild;
x->rightChild->parent = x;
y->leftChild = x;
y->leftChild->parent = y;
return y;
}
Node* rotateRight(Node* x) {
Node* y = x->leftChild;
x->leftChild = y->rightChild;
x->leftChild->parent = x;
y->rightChild = x;
y->rightChild->parent = y;
return y;
}
template <class NodeDataType> Pair<Node*, bool> _insert(Node* r, NodeDataType&& data) {
@@ -321,15 +322,11 @@ template <typename KeyType, typename NodeData, typename KeyFun, typename Compare
if (comp(keyFun(newNode->data), keyFun(r->data))) {
newNode->rightChild = r;
newNode->rightChild->parent = newNode;
newNode->leftChild = r->leftChild;
newNode->leftChild->parent = newNode;
r->leftChild = nullptr;
} else {
newNode->leftChild = r;
newNode->leftChild->parent = newNode;
newNode->rightChild = r->rightChild;
newNode->rightChild->parent = newNode;
r->rightChild = nullptr;
}
_size++;
@@ -354,7 +351,6 @@ template <typename KeyType, typename NodeData, typename KeyFun, typename Compare
r = _splay(r->leftChild, key);
r->rightChild = temp->rightChild;
r->rightChild->parent = r;
}
std::allocator_traits<NodeAlloc>::destroy(alloc, temp);
alloc.deallocate(temp, 1);
@@ -372,16 +368,13 @@ template <typename KeyType, typename NodeData, typename KeyFun, typename Compare
if (comp(key, keyFun(r->leftChild->data))) {
r->leftChild->leftChild = _splay(r->leftChild->leftChild, key);
r->leftChild->leftChild->parent = r->leftChild;
r = rotateRight(r);
} else if (comp(keyFun(r->leftChild->data), key)) {
r->leftChild->rightChild = _splay(r->leftChild->rightChild, key);
r->leftChild->rightChild->parent = r->leftChild;
if (r->leftChild->rightChild != nullptr) {
r->leftChild = rotateLeft(r->leftChild);
r->leftChild->parent = r;
}
}
return (r->leftChild == nullptr) ? r : rotateRight(r);
@@ -391,15 +384,12 @@ template <typename KeyType, typename NodeData, typename KeyFun, typename Compare
if (comp(key, keyFun(r->rightChild->data))) {
r->rightChild->leftChild = _splay(r->rightChild->leftChild, key);
r->rightChild->leftChild->parent = r->rightChild;
if (r->rightChild->leftChild != nullptr) {
r->rightChild = rotateRight(r->rightChild);
r->rightChild->parent = r;
}
} else if (comp(keyFun(r->rightChild->data), key)) {
r->rightChild->rightChild = _splay(r->rightChild->rightChild, key);
r->rightChild->rightChild->parent = r->rightChild;
r = rotateLeft(r);
}
+1 -3
View File
@@ -38,6 +38,4 @@ void PipelineLayout::addDescriptorLayout(PDescriptorLayout layout) { descriptorS
void PipelineLayout::addPushConstants(const SePushConstantRange& pushConstant) { pushConstants.add(pushConstant); }
void PipelineLayout::addMapping(std::string name, uint32 index) {
parameterMapping[name] = index;
}
void PipelineLayout::addMapping(std::string mappingName, uint32 index) { parameterMapping[mappingName] = index; }
+18 -18
View File
@@ -199,14 +199,14 @@ DescriptorSet::DescriptorSet(PGraphics graphics, PDescriptorPool owner)
DescriptorSet::~DescriptorSet() {}
void DescriptorSet::updateConstants(const std::string& name, uint32 offset, void* data) {
std::memcpy(constantData.data() + owner->getLayout()->mappings[name].constantOffset, (char*)data + offset,
void DescriptorSet::updateConstants(const std::string& mappingName, uint32 offset, void* data) {
std::memcpy(constantData.data() + owner->getLayout()->mappings[mappingName].constantOffset, (char*)data + offset,
owner->getLayout()->mappings[name].constantSize);
}
void DescriptorSet::updateBuffer(const std::string& name, uint32 index, Gfx::PShaderBuffer shaderBuffer) {
void DescriptorSet::updateBuffer(const std::string& mappingName, uint32 index, Gfx::PShaderBuffer shaderBuffer) {
PShaderBuffer vulkanBuffer = shaderBuffer.cast<ShaderBuffer>();
const auto& map = owner->getLayout()->mappings[name];
const auto& map = owner->getLayout()->mappings[mappingName];
uint32 binding = map.binding;
if (boundResources[binding][index] == vulkanBuffer->getAlloc() || vulkanBuffer->getAlloc() == nullptr) {
return;
@@ -230,9 +230,9 @@ void DescriptorSet::updateBuffer(const std::string& name, uint32 index, Gfx::PSh
boundResources[binding][index] = vulkanBuffer->getAlloc();
}
void DescriptorSet::updateBuffer(const std::string& name, uint32 index, Gfx::PVertexBuffer indexBuffer) {
void DescriptorSet::updateBuffer(const std::string& mappingName, uint32 index, Gfx::PVertexBuffer indexBuffer) {
PVertexBuffer vulkanBuffer = indexBuffer.cast<VertexBuffer>();
const auto& map = owner->getLayout()->mappings[name];
const auto& map = owner->getLayout()->mappings[mappingName];
uint32 binding = map.binding;
if (boundResources[binding][index] == vulkanBuffer->getAlloc() || vulkanBuffer->getAlloc() == nullptr) {
return;
@@ -257,9 +257,9 @@ void DescriptorSet::updateBuffer(const std::string& name, uint32 index, Gfx::PVe
boundResources[binding][index] = vulkanBuffer->getAlloc();
}
void DescriptorSet::updateBuffer(const std::string& name, uint32 index, Gfx::PIndexBuffer indexBuffer) {
void DescriptorSet::updateBuffer(const std::string& mappingName, uint32 index, Gfx::PIndexBuffer indexBuffer) {
PIndexBuffer vulkanBuffer = indexBuffer.cast<IndexBuffer>();
const auto& map = owner->getLayout()->mappings[name];
const auto& map = owner->getLayout()->mappings[mappingName];
uint32 binding = map.binding;
if (boundResources[binding][index] == vulkanBuffer->getAlloc() || vulkanBuffer->getAlloc() == nullptr) {
return;
@@ -284,9 +284,9 @@ void DescriptorSet::updateBuffer(const std::string& name, uint32 index, Gfx::PIn
boundResources[binding][index] = vulkanBuffer->getAlloc();
}
void DescriptorSet::updateSampler(const std::string& name, uint32 index, Gfx::PSampler samplerState) {
void DescriptorSet::updateSampler(const std::string& mappingName, uint32 index, Gfx::PSampler samplerState) {
PSampler vulkanSampler = samplerState.cast<Sampler>();
const auto& map = owner->getLayout()->mappings[name];
const auto& map = owner->getLayout()->mappings[mappingName];
uint32 binding = map.binding;
if (boundResources[binding][index] == vulkanSampler->getHandle()) {
return;
@@ -312,9 +312,9 @@ void DescriptorSet::updateSampler(const std::string& name, uint32 index, Gfx::PS
boundResources[binding][index] = vulkanSampler->getHandle();
}
void DescriptorSet::updateTexture(const std::string& name, uint32 index, Gfx::PTexture2D texture) {
void DescriptorSet::updateTexture(const std::string& mappingName, uint32 index, Gfx::PTexture2D texture) {
TextureBase* vulkanTexture = texture.cast<TextureBase>().getHandle();
const auto& map = owner->getLayout()->mappings[name];
const auto& map = owner->getLayout()->mappings[mappingName];
uint32 binding = map.binding;
if (boundResources[binding][index] == vulkanTexture->getHandle()) {
return;
@@ -340,9 +340,9 @@ void DescriptorSet::updateTexture(const std::string& name, uint32 index, Gfx::PT
boundResources[binding][index] = vulkanTexture->getHandle();
}
void DescriptorSet::updateTexture(const std::string& name, uint32 index, Gfx::PTexture3D texture) {
void DescriptorSet::updateTexture(const std::string& mappingName, uint32 index, Gfx::PTexture3D texture) {
TextureBase* vulkanTexture = texture.cast<TextureBase>().getHandle();
const auto& map = owner->getLayout()->mappings[name];
const auto& map = owner->getLayout()->mappings[mappingName];
uint32 binding = map.binding;
if (boundResources[binding][index] == vulkanTexture->getHandle()) {
return;
@@ -368,9 +368,9 @@ void DescriptorSet::updateTexture(const std::string& name, uint32 index, Gfx::PT
boundResources[binding][index] = vulkanTexture->getHandle();
}
void DescriptorSet::updateTexture(const std::string& name, uint32 index, Gfx::PTextureCube texture) {
void DescriptorSet::updateTexture(const std::string& mappingName, uint32 index, Gfx::PTextureCube texture) {
TextureBase* vulkanTexture = texture.cast<TextureBase>().getHandle();
const auto& map = owner->getLayout()->mappings[name];
const auto& map = owner->getLayout()->mappings[mappingName];
uint32 binding = map.binding;
if (boundResources[binding][index] == vulkanTexture->getHandle()) {
return;
@@ -396,9 +396,9 @@ void DescriptorSet::updateTexture(const std::string& name, uint32 index, Gfx::PT
boundResources[binding][index] = vulkanTexture->getHandle();
}
void DescriptorSet::updateAccelerationStructure(const std::string& name, uint32 index, Gfx::PTopLevelAS as) {
void DescriptorSet::updateAccelerationStructure(const std::string& mappingName, uint32 index, Gfx::PTopLevelAS as) {
auto tlas = as.cast<TopLevelAS>();
uint32 binding = owner->getLayout()->mappings[name].binding;
uint32 binding = owner->getLayout()->mappings[mappingName].binding;
accelerationInfos.add(VkWriteDescriptorSetAccelerationStructureKHR{
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR,
.pNext = nullptr,
+2 -2
View File
@@ -88,7 +88,7 @@ TEST(ArraySuite, remove_iterator)
array.add(3);
array.add(4);
array.add(5);
array.remove(array.find(1), false);
array.erase(array.find(1), false);
ASSERT_EQ(array[0], 5);
ASSERT_EQ(array[1], 2);
ASSERT_EQ(array[2], 3);
@@ -104,7 +104,7 @@ TEST(ArraySuite, remove_iterator_keep_order)
array.add(3);
array.add(4);
array.add(5);
array.remove(array.find(1));
array.erase(array.find(1));
ASSERT_EQ(array[0], 2);
ASSERT_EQ(array[1], 3);
ASSERT_EQ(array[2], 4);
+1 -19
View File
@@ -35,22 +35,4 @@ TEST(ListSuite, basic_remove)
it = list.remove(it);
ASSERT_EQ(*it, 4);
ASSERT_EQ(list.size(), 2);
}
TEST(ListSuite, list_join)
{
List<int> list1;
List<int> list2;
list1.add(2);
list1.add(1);
list1.add(3);
list1.add(4);
list2.add(5);
list2.add(7);
list2.add(8);
list2.add(6);
list2.add(9);
list1.moveElements(std::move(list2));
ASSERT_EQ(list1.size(), 9);
ASSERT_EQ(list2.size(), 0);
}
}