C++を初めて使用しています。私はB +ツリーを実装していて、それはMacbook(CLion)でうまく動作していますが、私がUbuntuサーバーで実行すると、以下のコンパイルエラーが発生します。誰か助けてもらえますか?エラー:呼び出しに一致する関数がありません。C++
error: no matching function for call to
‘std::vector<std::__cxx11::basic_string<char>
>::vector(__gnu_cxx::__normal_iterator<const
std::__cxx11::basic_string<char>*,
std::vector<std::__cxx11::basic_string<char> > >,
std::vector<std::__cxx11::basic_string<char> >::iterator)’
結果G ++ -v Mac上:
で構成:--prefix = /ライブラリ/開発/ CommandLineToolsは/ usr --with-GXX-含ま-dirを=は/ usr /含めます/ C++/4.2.1 アップルLLVMのバージョン9.0.0(打ち鳴らす-900.0.38) ターゲット:x86_64版 - アップルdarwin16.7.0 スレッドモデル:POSIX InstalledDir:/ライブラリ/開発/ CommandLineToolsは/ usr/binに
ubuntuサーバー上のg ++ -vの結果:
gccのバージョン5.4.0 20160609(Ubuntuの5.4.0-6ubuntu1〜16.04.5)エラーがスローされ
コードスニペット:イテレータとstd::vector
を構築
std::pair<InternalNode *, Node *> split(int order) {
std::vector<float>::const_iterator old_dn_keys_end = keys.begin() + ceil(float(order)/2) - 2;
std::vector<std::string>::const_iterator old_dn_values_end = values.begin() + ceil(float(order)/2) - 2;
new_dn->keys = std::vector<float>(old_dn_keys_end + 1, keys.end());
//**--- error here ---**
new_dn->values = std::vector<std::string>(old_dn_values_end + 1,
values.end());
//rest of the code...
}