如何在编译时从字符串生成boost uuid
有没有办法在编译时从 988A00C4-79F3-46f9-98CD-D5AD4AA2A0FE 这样的字符串生成 boost uuid ?
is there a way to generate a boost uuid from a string like 988A00C4-79F3-46f9-98CD-D5AD4AA2A0FE at compile time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,因为在 C++ 中编译时没有对字符串文字进行处理。
根据您的需要以及从何处获取字符串,您可以使用预构建步骤,将其直接放入某种聚合初始值设定项形式或可以在编译时处理的内容(即编译时字符列表)。
No, because there is no processing of string literals at compile time in C++.
Depending on what you need and where you get the string from, you could use a pre-build-step that directly puts it into some aggregate initializer form or something that you can process at compile time (i.e. compile-time lists of characters).