错误C4716:&x27;操作员<<';:必须返回一个值 我努力为这个操作员获得适当的回报(这不是我的代码,只是试图纠正它,我不如C++中的那样更正它)。有人能帮我吗?它是为数字电路的高级设计定义的数据类型类。< / P>
如何返回此错误C4716:&x27;操作员<<';:必须返回一个值 我努力为这个操作员获得适当的回报(这不是我的代码,只是试图纠正它,我不如C++中的那样更正它)。有人能帮我吗?它是为数字电路的高级设计定义的数据类型类。< / P>,c++,operator-overloading,systemc,C++,Operator Overloading,Systemc,如何返回此temp而不出错,是否有任何特殊方法 inline friend std::ostream& operator << ( std::ostream& os, const sc_float &v) { if (c_DEBUG) std::cout << "debug: operator << called " << endl; //debug // fixme - this is only copy of
temp
而不出错,是否有任何特殊方法
inline friend std::ostream& operator << ( std::ostream& os, const sc_float &v)
{
if (c_DEBUG) std::cout << "debug: operator << called " << endl; //debug
// fixme - this is only copy of sc_float2double function
double temp;
temp = (double)v.man / exp2(m_width);
temp += 1.0;
temp *= exp2((double)v.exp - exp2((double)e_width - 1.0) + 1.0);
temp *= (v.sign == true ? -1.0 : 1.0);
//os << "(" << v.sign << " , " << v.exp << " , " << v.man << ")"; // debug
os << temp;
}
inline friend std::ostream&operator您的函数缺少返回值。您的函数缺少返回值。返回属于std::ostream的对象
:返回操作系统
返回属于std::ostream的对象
:返回操作系统代码>
cout << foo << bar << foobar;
inline friend std::ostream& operator << ( std::ostream& os, const sc_float &v)
{
//...
os << temp;
return os;// <-- this returns the stream that we are unsing so it can be used by other functions
}