Created
April 3, 2017 22:42
-
-
Save qpfiffer/d5fbd18daa9b6d75839e4b0430ea9562 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
λ:~/src clang++ -o test_static_cast ./test_static_cast.cpp | |
./test_static_cast.cpp:7:42: error: no matching conversion for static_cast from 'std::string' (aka 'basic_string<char>') to 'std::vector<unsigned char>' | |
std::vector<unsigned char> new_str = static_cast<std::vector<unsigned char> >(test_string); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <string> | |
#include <vector> | |
int main(int argc, char *argv[]) { | |
std::string test_string = "Hello, world!"; | |
std::vector<unsigned char> new_str = static_cast<std::vector<unsigned char> >(test_string); | |
printf("%s\n", new_str); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
went with: