Handle value category propagation

Đang mở
#97 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@RyanJK5 đang làm issue này rồi.

Từ ngày 11/9/2026.

  • #356 của @RyanJK5 — đang mở

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.

Ngôn ngữ chính
C++
Star
12
Fork
4
Merge trung bình
1 ngày 11 giờ
Pull request đã merge (30 ngày)
15

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của jbcoe/cc-protocol

Tất cả issue của jbcoe/cc-protocol

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.