简体   繁体   中英

Can you convert vector<unsigned char> to byte[]?

Can you convert a vector<unsigned char> from C++/CLI to a byte[] in C#?

I looked far and wide but couldn't find any answer to this question.

Yes. A std::vector<T> is contiguous, that is to say &v[i] == &v[0]+i for i<v.size() . And on C++/CLI platforms (specifically), unsigned char is exactly 8 bits (a C# byte ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM