简体   繁体   English

无法从'std :: vector <_Ty>'转换为'std :: vector <_Ty>&

[英]cannot convert from 'std::vector<_Ty>' to 'std::vector<_Ty> &

Hi so i have two Problems: 嗨,我有两个问题:

  1. 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(); } 

    The Error appears at: 错误出现在:

     std::vector<CFilename>& rSoundFileNameVector = m_propertyAmbience.AmbienceSoundVector; 
  2. None of the 2 overloads could convert all the argument types: 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); } 

    at DeleteVectorItem<CFilename>(&m_propertyAmbience.AmbienceSoundVector, dwCurSel); DeleteVectorItem<CFilename>(&m_propertyAmbience.AmbienceSoundVector, dwCurSel);

Full Errors 完全错误

1>Dialog\MapObjectPropertyPageAmbience.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>Dialog\MapObjectPropertyPageAmbience.cpp(205): error C2665: 'DeleteVectorItem' : none of the 2 overloads could convert all the argument types
1>          d:\dev\kraizy\novaline\srcs\client\eterpack\../eterBase/Stl.h(146): could be 'void DeleteVectorItem<CFilename>(std::vector<_Ty> *,unsigned long)'
1>          with
1>          [
1>              _Ty=CFilename
1>          ]
1>          d:\dev\kraizy\novaline\srcs\client\eterpack\../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>          ]

You are trying to use vector<string> in places where vector<CFilename> is expected. 您试图在需要vector<CFilename>地方使用vector<string> Those are completely unrelated types. 这些是完全无关的类型。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法将参数3从&#39;std :: vector &lt;_Ty&gt; *&#39;转换为&#39;库存*&#39;。 为什么? - cannot convert parameter 3 from 'std::vector<_Ty> *' to 'Inventory *'. Why? “MessageBoxA”:无法将参数 2 从“std::vector<_Ty>”转换为“LPCSTR” - 'MessageBoxA' : cannot convert parameter 2 from 'std::vector<_Ty>' to 'LPCSTR' 无法将&#39;this&#39;指针从&#39;std :: stack &lt;_Ty&gt;&#39;转换为&#39;std :: stack &lt;_Ty&gt;&&#39; - Cannot convert 'this' pointer from 'std::stack<_Ty>' to 'std::stack<_Ty> &' 错误C2440:&#39;初始化&#39;:无法从&#39;初始化列表&#39;转换为&#39;std :: vector <char *,std::allocator<_Ty> &gt;” - error C2440: 'initializing': cannot convert from 'initializer list' to 'std::vector<char *,std::allocator<_Ty>>' 接收错误C2664:传递向量时,无法将参数1从&#39;std :: vector &lt;_Ty&gt;&#39;转换为&#39;std :: vector &lt;_Ty,_Ax&gt;&&#39; <int> 模板法 - Receiving error C2664: cannot convert parameter 1 from 'std::vector<_Ty>' to 'std::vector<_Ty,_Ax> &' when passing vector<int> to templated method 错误C2440:“正在初始化”:无法从“ std :: _ Vector_iterator &lt;_Ty,_Alloc&gt;”转换为“类型*” - error C2440: 'initializing' : cannot convert from 'std::_Vector_iterator<_Ty,_Alloc>' to 'type *' 错误C2440:“类型转换”:无法从“ std :: _ Vector_iterator &lt;_Ty,_Alloc&gt;”转换为“ DWORD” - error C2440: 'type cast' : cannot convert from 'std::_Vector_iterator<_Ty,_Alloc>' to 'DWORD' &#39;std :: list &lt;_Ty&gt; :: push_back&#39;:无法将&#39;this&#39;指针从&#39;const std :: list &lt;_Ty&gt;&#39;转换为&#39;std :: list &lt;_Ty&gt;&&#39; - 'std::list<_Ty>::push_back' : cannot convert 'this' pointer from 'const std::list<_Ty>' to 'std::list<_Ty> &' 错误C2664:&#39;void std :: vector &lt;_Ty&gt; :: push_back(_Ty &amp;&amp;)&#39;:无法从&#39;Node转换参数1 <T> *&#39;到&#39;节点 <T> &amp;&amp;” - error C2664 : 'void std::vector<_Ty>::push_back(_Ty&&)': cannot convert parameter 1 from 'Node<T> *' to 'Node<T>&&' std :: pair &lt;_Ty1,_Ty2&gt; :: pair &lt;_Ty1,_Ty2&gt;&无法转换参数 - std::pair<_Ty1,_Ty2>::pair<_Ty1,_Ty2>& Cannot convert parameter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM