⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elabret.cpp

📁 数值计算工具库,C语言编写的,可以直接调用.
💻 CPP
字号:
#ifdef BZ_NO_TYPENAME
 #define typename
#endif


// Template-qualified return type, necessary for type promotion on vectors
// BZ_TEMPLATE_QUALIFIED_RETURN_TYPE

template<class X, class Y>
struct promote_trait {
    typedef X T;
};


template<>struct promote_trait<int, float> {
    typedef float T;
};

template<class T>
class Vector {
public:
    Vector() { }
};

template<class X, class Y>
Vector<typename promote_trait<X,Y>::T> operator+(const Vector<X>&, 
    const Vector<Y>&)
{ 
    return Vector<typename promote_trait<X,Y>::T>();
}

int main()
{
    Vector<int> x;
    Vector<float> y;
    Vector<float> z = x + y;
    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -