Handle value category propagation

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

メンテナーはふだん 1 日以内に返信

@RyanJK5 がすでに取り組んでいます。

2026年9月11日 から。

  • #356 @RyanJK5 による — オープン

評価

この issue はまだ評価されていません。

説明

protocol already propagates const-ness: that is, a const protocol<I> implies that only the const members of I can be used.

An extension of this is propagating the object's value category, i.e. lvalue or rvalue. How should the following behave?

struct Interface {
    int foo() &&;
    int bar() &;
};

struct A {
    int foo() && { return 1; }
    int bar() & { return 2; }
};

protocol<Interface> p{A{}};

p.bar(); // OK
protocol<Interface>{A{}}.foo(); // OK?

p.foo(); // ERROR?
std::move(p).bar(); // ERROR?

From an implementation perspective, this would require adding overloads to named_forwarder, and require carefully persisting T& / T&& throughout.

This should probably be acknowledged in the draft, but the feature itself could potentially be deferred to a later extension of protocol.

主要言語
C++
スター
12
フォーク
4
平均マージ
1日 11時間
マージ済み PR(30日)
15

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

jbcoe/cc-protocol のほかの issue

jbcoe/cc-protocol の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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