我写代码像
template <typename XAxis, typename YAxis>
class Interpolation {
public:
using x_value_type = typename XAxis::value_type;
using y_value_type = typename YAxis::value_type;
Interpolation(const XAxis& x_axis, const YAxis& y_axis)
: _x_axis(x_axis), _y_axis(_y_axis)
{}
public:
y_value_type interpolate(const x_value_type& x) const;
private:
const XAxis _x_axis;
const XAxis _y_axis;
};
Run Code Online (Sandbox Code Playgroud)
当我想要成员变量是不可变的时。
我感到有点焦虑,为什么我认为我可能因某种原因知道上面的代码是非法的或坏的代码。
您认为常量成员变量有什么好处或没有什么好处?
请告诉我你的理由。
我尝试使用RxSwift + MVVM架构开发iOS应用。
我有个问题。谁应该拥有DisposeBag实例?
现在,我在代码中实现了以下内容。
是好的设计吗?
我想要代码标准,请给我您的意见。