Boost Parameterチュートリアルを使用して、トランプ ジェネレーター用の名前付きパラメーター コンストラクターを作成しています。チュートリアルでは ArgumentPack を基本クラスに入れるように書かれていますが、カード ジェネレーター クラスの変数を変更したいと考えています。私はこれを行うことを考えました:
class CGconstructor_base {
public:
template<class ArgumentPack>
CGconstructor_base(ArgumentPack const& args);/*tutorial says to put code
in this function */
friend CardGenerator;//so it can modify the variables of CardGenerator
}
class CardGenerator:public CGconstructor_base;
これは合法ですか、それとも CardGenerator のプライベート変数を操作してブースト パラメータ ライブラリを使用するより良い方法はありますか? OS: Windows XP Pro、コンパイラ: Visual C++ 2008 Express、ブースト: 1.39.0