 |
|
cxiaobao
V2EX member #62797, joined on 2014-05-16 11:29:54 +08:00Today's activity rank 16067
|
cxiaobao's recent replies
template <class T>
1018 static inline std::unique_ptr<T> fromJsonString(const std::string&& str)
1019 {
1020 std::unique_ptr<T> model = std::make_unique<T>();
1021 privates::jsonType<T>::type::from_jsonStr(std::move(*model), std::move(str), 0, static_cast<int>(str.length() - 1));
1022 ~~~~~~~~~~~~~~ model 是移动语义进入 from_jsonStr 方法的,如果 from_jsonStr 取走了数据所有权,model 会被清空
1023 return model;
~~~~~~~~~ 这里不应该返回 model ,因为 model 可能已经被清空了,
通常,from_jsonStr 应该返回一个对象,这个对象取得了原本 model 中的数据,应该考虑返回这个对象
1024 }
畅网 n100 开发板(带 m2 一转 4 ):750
M2 转 6 口 SATA:100
3D 打印 NAS 机箱(带 2.5 盘位 x2 ):300
6 盘位 QNAS 背板:250
9 寸散热风扇 x2: 50
3.5 x 6 + 2.5 x 2 + M2 x 4