Skip to content

Commit

Permalink
Merge pull request #649 from elbeno/fix-size-t-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
lukevalenty authored Nov 21, 2024
2 parents 66a6d9d + 9f6b35d commit e0e4319
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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);
}

0 comments on commit e0e4319

Please sign in to comment.