c++ - MSVS 2015: vector<bool> has no 'data' member -
i have following code compiles fine:
void foo::bar(const vector<int> arg) { int* ptr = arg.data(); // ptr }
i need overload function vector<bool>
void foo::bar(const vector<bool> arg) { int* ptr = arg.data(); // error c2039: 'data': not member ofstd::vector<bool,std::allocator<_ty>>' // ptr }
what reason vector<bool>
not have data()
member?
here (en.cppreference.com) did not find somethign specific bool
case of std::vector
.
the code compiled msvs 2015.
usual vector<t>
store data 1 contiguous block of t
's, it's possible return pointer them array.
vector<bool>
stores several boolean values in 1 byte, it's not possible return such pointer
Comments
Post a Comment