无法从"std::vector<_Ty>"转换为"std::vector<_Ty>
cannot convert from 'std::vector<_Ty>' to 'std::vector<_Ty> &
嗨,所以我有两个问题:
-
cannot convert from 'std::vector<_Ty>' to 'std::vector<_Ty> &
void CMapObjectPropertyPageAmbience::OnUpdateUI(CProperty* pProperty) { prt::PropertyAmbienceStringToData(pProperty, &m_propertyAmbience); std::vector<CFilename>& rSoundFileNameVector = m_propertyAmbience.AmbienceSoundVector; for (DWORD dwIndex = 0; dwIndex < rSoundFileNameVector.size(); ++dwIndex) { m_ctrlSoundFileList.InsertString(dwIndex, rSoundFileNameVector[dwIndex].c_str()); } m_ctrlPlayType.SelectString(-1, m_propertyAmbience.strPlayType.c_str()); SetDialogFloatText(GetSafeHwnd(), IDC_MAP_OBJECT_PROPERTY_AMBIENCE_INTERVAL, m_propertyAmbience.fPlayInterval); SetDialogFloatText(GetSafeHwnd(), IDC_MAP_OBJECT_PROPERTY_AMBIENCE_INTERVAL_VARIATION, m_propertyAmbience.fPlayIntervalVariation); SetDialogFloatText(GetSafeHwnd(), IDC_MAP_OBJECT_PROPERTY_AMBIENCE_MAX_VOLUME_AREA_PERCENTAGE, m_propertyAmbience.fMaxVolumeAreaPercentage * 100.0f); OnUpdatePropertyData(m_propertyAmbience.strName.c_str()); OnChangePlayType(); }
错误出现在:
std::vector<CFilename>& rSoundFileNameVector = m_propertyAmbience.AmbienceSoundVector;
-
2 个重载都无法转换所有参数类型:
void CMapObjectPropertyPageAmbience::OnDeleteSoundFile() { DWORD dwCurSel = DWORD(m_ctrlSoundFileList.GetCurSel()); if (dwCurSel >= m_propertyAmbience.AmbienceSoundVector.size()) return; DeleteVectorItem < CFilename > ( & m_propertyAmbience.AmbienceSoundVector, dwCurSel); m_ctrlSoundFileList.DeleteString(dwCurSel); }
在
DeleteVectorItem<CFilename>(&m_propertyAmbience.AmbienceSoundVector, dwCurSel);
完全错误
1>DialogMapObjectPropertyPageAmbience.cpp(78): error C2440: 'initializing' : cannot convert from 'std::vector<_Ty>' to 'std::vector<_Ty> &'
1> with
1> [
1> _Ty=std::string
1> ]
1> and
1> [
1> _Ty=CFilename
1> ]
1>DialogMapObjectPropertyPageAmbience.cpp(205): error C2665: 'DeleteVectorItem' : none of the 2 overloads could convert all the argument types
1> d:devkraizynovalinesrcsclienteterpack../eterBase/Stl.h(146): could be 'void DeleteVectorItem<CFilename>(std::vector<_Ty> *,unsigned long)'
1> with
1> [
1> _Ty=CFilename
1> ]
1> d:devkraizynovalinesrcsclienteterpack../eterBase/Stl.h(191): or 'void DeleteVectorItem<CFilename>(std::vector<_Ty> *,T)'
1> with
1> [
1> _Ty=CFilename,
1> T=CFilename
1> ]
1> while trying to match the argument list '(std::vector<_Ty> *, DWORD)'
1> with
1> [
1> _Ty=std::string
1> ]
您正在尝试在预期vector<CFilename>
的地方使用vector<string>
。这些是完全不相关的类型。
相关文章:
- EASTL矢量<向量<int>>连续的
- C - 创建矢量&lt; vector&lt; double&gt;&gt;矩阵具有分配而不是inizializ
- C 字符串比较“祝您好运”&gt;“再见”
- 为什么将此对向量&lt; map&lt; int,int&gt;&gt;中的地图进行更新.失败
- C :对矢量进行排序&lt; struct&gt;(结构有2个整数)基于结构的整数之一
- C 操作员&gt;&gt;与突变器过载
- 明确的专业化“ CheckIntmap&lt;&gt;”实例化
- 是否需要使用 - &gt;运算符在C 中调用成员函数时
- 什么是模板&lt;&gt;inline bla bla
- 编辑C Qlist&lt; object*&gt; gt;QML代码和一些QML警告中的模型
- eigen :: llt&lt;eigen :: matrixxd&gt;具有不完整的类型
- 错误,包括&lt; ctype&gt;在原子上使用C 11
- 错误c++visual studio c2227左侧'->;Init';必须指向类/结构/联合/泛型类型
- std::vector<;uint8_t>;当C++11/14启用时,手动复制而不是调用memcpy
- ``这个''不能用this-&gt;指针变量
- 如何加入向量&lt; int&gt;到C 中的单个INT
- 是std :: set&lt; std :: future&gt;不可能存在
- 使用shared_ptr<字符串>转换为一个无序集合<字符串>
- 是numeric_limits&lt; int&gt; :: is_modulo从逻辑上矛盾
- opencv 2.4.7在iOS错误背景_segm.hpp #include&lt; list&gt;未找到