As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center提供指导。
7年前关闭。
我知道位集不能动态分配,因为它们是基于模板参数的,但是为什么以这种方式实现位集呢?
谢谢
7年前关闭。
我知道位集不能动态分配,因为它们是基于模板参数的,但是为什么以这种方式实现位集呢?
谢谢
最佳答案
效率?因为这是一个常见的用例?如果要动态位集,请考虑使用vector<bool>
。它甚至还定义了一些操作。但是请先阅读this。