Skip to content
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
2 changes: 1 addition & 1 deletion include/lookup/input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <type_traits>

namespace lookup {
template <typename K, typename V = K, auto N = 0ul> struct input {
template <typename K, typename V = K, std::size_t N = 0> struct input {
using key_type = K;
using value_type = V;

Expand Down
12 changes: 6 additions & 6 deletions test/lookup/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ TEST_CASE("an input with no entries (type deduced)", "[input]") {
constexpr auto input = lookup::input{1};
CHECK(input.default_value == 1);
static_assert(
std::is_same_v<decltype(input), lookup::input<int, int, 0ul> const>);
CHECK(std::size(input) == 0ul);
std::is_same_v<decltype(input), lookup::input<int, int, 0> const>);
CHECK(std::size(input) == 0);
}

TEST_CASE("an input with no entries (explicit types)", "[input]") {
constexpr auto input = lookup::input<float, int>{1};
CHECK(input.default_value == 1);
static_assert(
std::is_same_v<decltype(input), lookup::input<float, int, 0ul> const>);
CHECK(std::size(input) == 0ul);
std::is_same_v<decltype(input), lookup::input<float, int, 0> const>);
CHECK(std::size(input) == 0);
}

TEST_CASE("an input with some entries (type deduced)", "[input]") {
constexpr auto input = lookup::input(1, std::array{lookup::entry{1.0f, 2}});
CHECK(input.default_value == 1);
static_assert(
std::is_same_v<decltype(input), lookup::input<float, int, 1ul> const>);
CHECK(std::size(input) == 1ul);
std::is_same_v<decltype(input), lookup::input<float, int, 1> const>);
CHECK(std::size(input) == 1);
}