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

frozen: init at 1.1.1 #248571

Closed
wants to merge 1 commit into from
Closed
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
26 changes: 26 additions & 0 deletions pkgs/development/libraries/frozen/01-fix-gcc-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/include/frozen/unordered_set.h b/include/frozen/unordered_set.h
index 4d16df9..196ea50 100644
--- a/include/frozen/unordered_set.h
+++ b/include/frozen/unordered_set.h
@@ -105,7 +105,7 @@ public:
/* lookup */
template <class KeyType, class Hasher, class Equal>
constexpr std::size_t count(KeyType const &key, Hasher const &hash, Equal const &equal) const {
- auto const k = lookup(key, hash);
+ auto const & k = lookup(key, hash);
return equal(k, key);
}
template <class KeyType>
diff --git a/tests/test_unordered_set.cpp b/tests/test_unordered_set.cpp
index e90a0d4..042c1a8 100644
--- a/tests/test_unordered_set.cpp
+++ b/tests/test_unordered_set.cpp
@@ -65,7 +65,7 @@ TEST_CASE("tripleton str frozen unordered set", "[unordered set]") {
constexpr auto max_size = ze_set.max_size();
REQUIRE(max_size == 3);

- constexpr auto nocount = ze_set.count(4);
+ const auto nocount = ze_set.count(4);
REQUIRE(nocount == 0);

constexpr auto count = ze_set.count(1);
37 changes: 37 additions & 0 deletions pkgs/development/libraries/frozen/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, ninja
}:

stdenv.mkDerivation rec {
pname = "frozen";
version = "1.1.1";

src = fetchFromGitHub {
owner = "serge-sans-paille";
repo = "frozen";
rev = version;
hash = "sha256-HebDTRg1+snUwu+KumrgNMt/GOWXdHM9pMgXi51eArk=";
};

patches = [
# Version 1.1.1 fails to build with gcc
./01-fix-gcc-build.patch
];

nativeBuildInputs = [
cmake
ninja
];

doCheck = true;

meta = with lib; {
homepage = "https://github.com/serge-sans-paille/frozen";
description = "a header-only, constexpr alternative to gperf for C++14 users";
license = licenses.asl20;
platforms = platforms.unix;
};
}
Loading