constクラスのユーザーに、コンストラクターに使用されるデータに基づいてオブジェクトを構築させる方法はありますか?
たとえば、バッファの周りに小さなラッパー クラスがあるとしますconst。const
class Wrapper {
public:
Wrapper(const char*);
Wrapper(char*);
};
ユーザーが を提供している場合、コンパイル時にconstオブジェクトを宣言するよう強制できますか。constあれは
// you have to do this if the input is const
const char* a;
// this will not compile
Wrapper w(a);
// but this will
const Wrapper(a);
何か案は?