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

Remove non-const qualified ranges for fixed_size_layout #58

Merged
Merged
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
18 changes: 0 additions & 18 deletions include/sparrow/fixed_size_layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ namespace sparrow
using const_bitmap_range = std::ranges::subrange<const_bitmap_iterator>;
using const_value_range = std::ranges::subrange<const_value_iterator>;

using bitmap_range = std::ranges::subrange<bitmap_iterator>;
using value_range = std::ranges::subrange<value_iterator>;

using iterator = layout_iterator<self_type, false>;
using const_iterator = layout_iterator<self_type, true>;

Expand All @@ -86,9 +83,6 @@ namespace sparrow
const_iterator cbegin() const;
const_iterator cend() const;

bitmap_range bitmap();
value_range values();

const_bitmap_range bitmap() const;
const_value_range values() const;

Expand Down Expand Up @@ -191,18 +185,6 @@ namespace sparrow
return const_iterator(value_cend(), bitmap_cend());
}

template <class T>
auto fixed_size_layout<T>::bitmap() -> bitmap_range
{
return std::ranges::subrange(bitmap_begin(), bitmap_end());
}

template <class T>
auto fixed_size_layout<T>::values() -> value_range
{
return std::ranges::subrange(value_begin(), value_end());
}

template <class T>
auto fixed_size_layout<T>::bitmap() const -> const_bitmap_range
{
Expand Down
17 changes: 5 additions & 12 deletions test/test_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,20 @@ namespace sparrow
{
layout_test_type lt(make_test_array_data(10, 1));
auto lt_values = lt.values();
layout_test_type::value_iterator iter = lt_values.begin();
// TODO: Allow coercion of iterator to const_iterator.
// layout_test_type::const_value_iterator citer = lt_values.begin();
CHECK(iter < lt_values.end());
// CHECK(citer < lt_values.end());
layout_test_type::const_value_iterator citer = lt_values.begin();
CHECK(citer < lt_values.end());
}

TEST_CASE("value_iterator_equality")
{
layout_test_type lt(make_test_array_data(10, 1));
auto lt_values = lt.values();
layout_test_type::value_iterator iter = lt_values.begin();
// TODO: Allow coercion of iterator to const_iterator.
// layout_test_type::const_value_iterator citer = lt_values.begin();
layout_test_type::const_value_iterator citer = lt_values.begin();
for (std::size_t i = 0; i < lt.size(); ++i)
{
CHECK_EQ(*iter++, lt[i]);
// CHECK_EQ(*citer++, lt[i]);
CHECK_EQ(*citer++, lt[i]);
}
CHECK_EQ(iter, lt_values.end());
// CHECK_EQ(citer, lt_values.end());
CHECK_EQ(citer, lt_values.end());
}

TEST_CASE("iterator")
Expand Down
Loading