V2EX terryching
 terryching 最近的时间轴更新
terryching

terryching

V2EX 第 418046 号会员,加入于 2019-06-03 08:55:45 +08:00
terryching 最近回复了
227 天前
回复了 jackie777 创建的主题 分享创造 TabTab v0.3.0 发布
能不能把浏览器本来的收藏夹一键导入进来,再慢慢调整
@ChristopherWu @nicefrp 迭代的挺快的,比之前好多了
提个建议,最上面的网站名称和“首页”之间是不是分开更好
飞书上竟然还有这么多公开文档,还以为就公司用用
这 UI 设计,一言难尽
感觉 ASAN 是最适合的
dGVycnlxaW5xdEAxNjMuY29t
2024-02-08 22:02:38 +08:00
回复了 wisefree 创建的主题 C++ C++ 如果通过解析字符串定义一个结构体
看看 GPT4 给出的答案:
运行时解析:使用已有的数据结构,如 std::map 或自定义的数据结构,来在运行时模拟结构体。基于解析得到的信息(字段名、类型、数组大小等),你可以动态地存储和访问数据。这种方法牺牲了类型安全和编译时优化,但提供了灵活性。
```c++
#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <typeinfo>
#include <cstdint>

class DynamicStruct {
public:
std::map<std::string, std::vector<uint8_t>> fields;

void addInt(const std::string& name, int value) {
auto data = reinterpret_cast<uint8_t*>(&value);
fields[name] = std::vector<uint8_t>(data, data + sizeof(value));
}

void addDouble(const std::string& name, double value) {
auto data = reinterpret_cast<uint8_t*>(&value);
fields[name] = std::vector<uint8_t>(data, data + sizeof(value));
}

int getInt(const std::string& name) {
if(fields.find(name) != fields.end()) {
auto& data = fields[name];
return *reinterpret_cast<const int*>(data.data());
}
return 0; // Or throw an exception
}

double getDouble(const std::string& name) {
if(fields.find(name) != fields.end()) {
auto& data = fields[name];
return *reinterpret_cast<const double*>(data.data());
}
return 0.0; // Or throw an exception
}

// Similar methods can be added for other types and arrays
};

int main() {
DynamicStruct myStruct;
myStruct.addInt("x", 123);
myStruct.addDouble("y", 456.789);
// For arrays, you might add them element by element or as a block if you know the size

std::cout << "x = " << myStruct.getInt("x") << std::endl;
std::cout << "y = " << myStruct.getDouble("y") << std::endl;

// Accessing array elements would require additional methods

return 0;
}
```
2023-07-21 22:48:12 +08:00
回复了 undertow 创建的主题 程序员 工作一天一般写多少行代码
如果有工作需要一天大部分时间敲代码,有两种能:1. 复杂度低的重复性代码; 2. 任务分配太多导致工作量大。无论哪种,都可以考虑跑路了
2021-08-20 10:34:27 +08:00
回复了 TOUJOURSER 创建的主题 职场话题 坐在我旁边的同事一直抖腿
直接说就行了,不要想太多
关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     974 人在线   最高记录 6679       Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 11ms UTC 23:11 PVG 07:11 LAX 15:11 JFK 18:11
Do have faith in what you're doing.
ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86