Constrain `protocol`'s constructors and converting assignment on constructibility of the stored type
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with the protocol value constructors, in-place constructors and converting assignment, and compare them with the polymorphic constructors, which already constrain on is_constructible_v. Add std::constructible_from constraints to the overloads the issue lists, and check that the converting assignment matches the change in #499. Done when the issue's static_asserts hold and protocol<MI> rejects MoveOnly at overload resolution instead of failing inside construct_at.
索引モデルが issue の本文から書いたものです。
説明
protocol's value, in-place and converting-assignment overloads check conformance and the interface's special members, but not that the stored type can be constructed from the arguments. Type traits report them as available, and calling one fails inside the allocator:
struct I { int value() const; };
struct MI {
MI() = default;
MI(MI&&) = default;
MI(const MI&) = delete;
int value() const;
};
struct MoveOnly { std::unique_ptr<int> p; int value() const; };
struct Small { int v; int value() const; };
static_assert(std::is_constructible_v<xyz::protocol<MI>, MoveOnly&>);
static_assert(std::is_assignable_v<xyz::protocol<MI>&, MoveOnly&>);
static_assert(std::is_constructible_v<xyz::protocol<I>,
std::in_place_type_t<Small>, std::string>);
MoveOnly m;
xyz::protocol<MI> p(m); // error: no matching function for call to construct_at
Generic code that branches on these traits gets a hard error instead of the other branch.
polymorphic constrains its value constructor on is_constructible_v<UU, U> and its in-place constructors on is_constructible_v<U, Ts...>. Proposal: add std::constructible_from<TNorm, T> to the value constructors and the converting assignment (#499), and std::constructible_from<T, Args...> (plus the initializer_list form) to the in-place constructors.
- 主要言語
- C++
- スター
- 12
- フォーク
- 4
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 15
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
jbcoe/cc-protocol のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
jbcoe/cc-protocol#507 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
jbcoe/cc-protocol#455 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
jbcoe/cc-protocol#407 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
jbcoe/cc-protocol#194 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
jbcoe/cc-protocol#513 ·
メンテナーはふだん 1 日以内に返信
jbcoe/cc-protocol の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
itinance/react-native-fs#1270 ·
-
clang:frontend clang:openmp crash
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
llvm/llvm-project#245442 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
ai_p1 comp-sql-syntax
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
ClickHouse/ClickHouse#133888 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜2日 初心者へのやさしさ 65/100