我在 VS2017 中使用 C++
typedef std::shared_ptr<my::myclass::Writer<mytype::myvar>> mySharedTypePtr;
mySharedTypePtr mySharedtestPtr;
typedef int32_t my_int32_type;
我需要编译这段代码
my_int32_type my_32_method(my_int32_type x, float y){//do something};
my_int32_type mt_32test;
尝试 1
mt_32test = my_32_method((my_int32_type )mySharedtestPtr, float y);// did not work error--> 'type cast': cannot convert from 'mySharedTypePtr' to 'my_int32_type '
尝试 2
mt_32test = my_32_method(static_cast<my_int32_type>mySharedtestPtr, float y);// did not work error--> 'type cast': cannot convert from 'mySharedTypePtr' to 'my_int32_type '
我正在尝试从一种 typedef 转换为另一种 mySharedtestPtr 到 my_int32_type
如何做到这一点?