Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

hash_combine, hash_range, and hash_value can be constexpr

オープン
#16 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
cpp
領域
tooling

調査の方向性

include/boost/container_hash/hash.hpp から始めて、hash_combine、hash_range、hash_value、それらのバリエーション、および BOOST_FUNCTIONAL_HASH_ROTL32 パスを調べてください。issue に記載されている C++14–17 と C++20+ の制約を比較してください。完了とは、既存の標準バージョンのパスを壊すことなく、該当する関数が constexpr をサポートすることです。

索引モデルが issue の本文から書いたものです。

説明

https://github.com/boostorg/container_hash/blob/develop/include/boost/container_hash/hash.hpp

Since most part of internal calculations are based on integer arithmetic and bitwise operations, I believe those three functions and all their variants can be marked constexpr today. Can someone please enlighten me, why the standard std::hash<T>::operator() and proposed std::hash_combine() in P0814R2 is not constexpr? (backward-compatibility, or other reasons?)

If we are to provide constexpr-ness, there are two cases of implementations:

  • When user is using standard later or equal to C++20
    • In this case, non-constexpr intrinsic like _rotl (defined for BOOST_FUNCTIONAL_HASH_ROTL32) can be replaced with std::rotl
  • When user is using C++14 to C++17 and one prefers constexpr
    • The library can fallback to bitwise implementation (which is always constexpr)
    • Currently Boost.ContainerHash provides no option for this case. I think new macro like BOOST_FUNCTIONAL_HASH_USE_CONSTEXPR is needed.

refs: cplusplus/papers#253

主要言語
C++
スター
40
フォーク
61
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

boostorg/container_hash のほかの issue

boostorg/container_hash の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。