As of C++17 there's also std::from_chars. The following function takes a string of hex characters and returns a vector of T:
#include <charconv>
template<typename T>
std::vector<T> hexstr_to_vec(const std::string& str, unsigned char chars_per_num = 2)
{
std::vector<T> out(str.size() / chars_per_num, 0);
T value;
for (int i = 0; i < str.size() / chars_per_num; i++) {
std::from_chars<T>(
str.data() + (i * chars_per_num),
str.data() + (i * chars_per_num) + chars_per_num,
value,
16
);
out[i] = value;
}
return out;
}