void OnReceived(std::shared_ptr<uint8_t> buffer, int len) {
.........
}
int main(){
std::vector<char> buffer(1000);
OnReceived((std::shared_ptr<uint8_t>)buffer.data(),rcvlen);
}
am trying to cast it but i cant i dont know why!!!
Error 1 error C2664: 'std::tr1::_Ptr_base<_Ty>::_Reset0' : cannot convert parameter 1 from 'char *' to 'uint8_t *' c:\program files\microsoft visual studio 10.0\vc\include\memory 1705
so how can i convert it?
You really don’t want to do that. Aside from the fact that char and uint8_t may be distinct types, even if you force the code to compile, your buffer will be deallocated twice, likely crashing your program. Just change OnReceived to accept a raw pointer.