Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missed clear to unsafe_free_list_storage #294

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions immer/heap/unsafe_free_list_heap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ struct unsafe_free_list_storage
{
free_list_node* data;
std::size_t count;

~head_t() { Heap::clear(); }
};

static head_t& head()
Expand Down
26 changes: 26 additions & 0 deletions test/flex_vector/unsafe.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// immer: immutable data structures for C++
// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente
//
// This software is distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt
//

#include <immer/flex_vector.hpp>
#include <immer/memory_policy.hpp>
#include <immer/vector.hpp>

using unsafe_memory =
immer::memory_policy<immer::unsafe_free_list_heap_policy<immer::cpp_heap>,
immer::no_refcount_policy,
immer::no_lock_policy>;

template <typename T>
using test_flex_vector_t = immer::flex_vector<T, unsafe_memory, 3u, 6u>;

template <typename T>
using test_vector_t = immer::vector<T, unsafe_memory, 3u, 6u>;

#define FLEX_VECTOR_T test_flex_vector_t
#define VECTOR_T test_vector_t
#include "generic.ipp"
21 changes: 21 additions & 0 deletions test/vector/unsafe.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// immer: immutable data structures for C++
// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente
//
// This software is distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt
//

#include <immer/memory_policy.hpp>
#include <immer/vector.hpp>

using unsafe_memory =
immer::memory_policy<immer::unsafe_free_list_heap_policy<immer::cpp_heap>,
immer::no_refcount_policy,
immer::no_lock_policy>;

template <typename T>
using test_vector_t = immer::vector<T, unsafe_memory, 3u, 6u>;

#define VECTOR_T test_vector_t
#include "generic.ipp"
Loading