草庐IT

bitesize

全部标签

c++ - 让模板通过指定 bitesize 在 char/short/int 之间进行选择?

我有这样的东西:templatestructbin{private:public:struct{int_value:SIZE;};}是否可以根据SIZE更改_value的数据类型?如果SIZE=8且 最佳答案 这不是特别优雅,但是:templatestructbest_integer_type{typedefbest_integer_type::typetype;};templatestructbest_integer_type{typedefchartype;};templatestructbest_integer_type{ty