0
//error C2784: 'HRESULT get_wrapper(T *,boost::function<R(void)>)' :
//could not deduce template argument for 'boost::function<R(void)>'
//from 'boost::_bi::bind_t<R,F,L>'
STDMETHODIMP CAttributeValue::get_Name(BSTR* pVal)
{
return get_wrapper(pVal, boost::bind<BSTR>(&CAttributeValue::getNameCOM, this)); //error here
}
template <class T> HRESULT get_wrapper(T* pVal, boost::function<T()> GetVal)
{
if(!pVal)
return E_POINTER;
HRESULT status = E_FAIL;
try {
*pVal = GetVal();
status = S_OK;
} catch (...) {}
return status;
}
BSTR CAttributeValue::getNameCOM() const
{
BOOST_STATIC_ASSERT(sizeof(TCHAR)==sizeof(wchar_t));
return TStr2CComBSTR(_name).Detach();
}
[i-hate-C++] : C++은 그렇게 나쁘지 않습니다. 적어도 자바는 아닙니다. – James
제 제안에서 편집 한 것을 보았습니다. 그러나 나는 틀 렸습니다. 미안합니다. 어쨌든 – Thomas
thx, 아프지 않으므로 그대로 두겠습니다. –