在Android上将std :: string转换为std :: vector <uint8_t>:没有匹配的构造函数

时间:2019-01-04 18:26:08

标签: android c++ android-studio

我正在导入Android项目的某些C ++方法将字符串转换为如下所示的向量(如here):

#include <string>
#include <vector>

void myMethod(std::string str) {
    std::vector<uint8_t> vec(str.begin(), str.end()); // error
}

虽然我没有遇到任何构建错误,但Android Studio在vec(str.begin(), str.end())下方给了我一条红线,指出

  

没有匹配的构造函数

它建议的唯一具有__first__last迭代器的构造函数具有以下参数:

_InputIterator __first, _InputIterator __last, const std::vector<unsigned char, std::__ndk1::allocator<unsigned char>>::allocator_type &__a, void * = 0

我想摆脱红色错误行(尝试these,无济于事),但我也不想花费额外的时间来改编我认为应该能够做的更多或更多的C ++代码。减少投入项目。由于没有构建错误,我是否需要为此担心?如果是,该如何解决?

我已经安装了Android Studio提供的针对CMake,LLDB,NDK等的每个更新。

0 个答案:

没有答案