在以下代码中调用C2663: MediaSetting::mutable_mediamessage: 2 overloads have no legal conversion for this pointer
时,有人可以帮我解决此错误mutable_mediamessage()
。
class MediaSetting : public ::google::protobuf::Message {
public:
inline ::MSG::MediaMessage* mutable_mediamessage(int index);
inline ::google::protobuf::RepeatedPtrField< ::MSG::MediaMessage >* mutable_mediamessage();
}
inline ::MSG::MediaMessage* MediaSetting::mutable_mediamessage(int index) {
return mediamessage_.Mutable(index);
}
inline ::google::protobuf::RepeatedPtrField< ::MSG::MediaMessage >*
MediaSetting::mutable_mediamessage() {
return &mediamessage_;
}
// my test codes
// ...
const ::MSG::MediaSetting& media = config.mediasetting();
::google::protobuf::RepeatedPtrField<::MSG::MediaMessage>* pmedia = media.mutable_mediamessage(); // Error C2663 is here
环境:VS2008
答案 0 :(得分:1)
您正尝试通过const引用访问非const成员函数。