Allow for move-only components.

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
cpp
領域
game-dev

調査の方向性

ComponentHelper::copy_component_to と e.assign(...) が使用する vtable 構築パスから始めます。copy-constructible の場合と deleted-copy-constructor の場合を比較します。move-only コンポーネントを substitution errors なしで代入でき、コピーを試みた場合は引き続き適切に失敗すれば完了です。

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

説明

Right now, trying to do e.assign<C>(...) for some C that has a deleted copy constructor will cause a substitution error when instantiating ComponentHelper::copy_component_to, even if that method is never called as the vtable still must be constructed. It would be nice to have proper support for move-only components as well.

A simple solution is to use SFINAE on ComponentHelper:

template <typename C>
+class ComponentHelper<C, std::enable_if_t<!std::is_copy_constructible_v<C>>>: public BaseComponentHelper { ... }

and to not actually copy in copy_component_to, but that delays any errors trying to copy until runtime. That is suboptimal, and there should be a much more elegant solution.

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

環境構築

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

はじめの一歩

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

alecthomas/entityx のほかの issue

alecthomas/entityx の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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