C++中是否存在称为rect的类型或C++语言中的类Rect?使用c或C++语言编写的代码
1
A
回答
6
写
template<class T>
struct podrect
{
T left;
T top;
T right;
T bottom;
};
template<class T>
struct rect
{
rect() : left(), top(), right(), bottom() {}
rect(T left, T top, T right, T bottom) :
left(left), top(top), right(right), bottom(bottom) {}
template<class Point>
rect(Point p, T width, T height) :
left(p.x), right(p.y), right(p.x + width), bottom(p.y + height) {}
T left;
T top;
T right;
T bottom;
};
typedef rect<int> intrect;
typedef rect<float> floatrect;
或这样的事情。这很简单。
11
+0
其他框架也提供矩形的类型。他们可能会或可能不会等同于微软的。 – 2010-05-27 17:42:05
相关问题
- 1. 用c语言编写的代码
- 2. 用C语言编写cgi代码
- 3. 生成使用C语言编写的
- 4. 我们可以用C语言的语法编写Objective-C代码吗?
- 5. 使用哪种语言编写代码?
- 6. 用c语言编写的tiff图像代码
- 7. Visual Studio代码支持用C#编写的语言服务器
- 8. comboBox如何停用C语言编写的代码#
- 9. 从英特尔汇编语言手动编写C代码?
- 10. 用C/C++或其他语言编写SOCKS?
- 11. C++的CUDA C语言代码
- 12. 查看语言(C/C++)的代码块
- 13. 与C语言代码
- 14. 如何在C语言中编写jQuery代码?
- 15. 编写C++代码
- 16. 用C语言编写的Apple Lossless(ALAC)编码器库,不用C++
- 17. 调试用C语言编写
- 18. 由K&R编写的C语言编程语言示例CH1
- 19. 从汇编语言编写C程序
- 20. 演员模型库,框架或用C语言编写的语言?
- 21. IRC bot的C语言编写的
- 22. PHP扩展与C语言编写的
- 23. 使用汇编语言编写C程序的函数
- 24. 写汇编代码的C++
- 25. 为什么用C/C++编程语言编写Node.js?
- 26. Google+使用C#和Oauth编写代码
- 27. 使用C#编写ASP代码
- 28. 无法调用用C语言编写的DLL函数++从C#
- 29. 用C语言编写队列,我的代码出错的地方
- 30. 编程语言如何调用用其他语言编写的代码?
Thanx为此。 – boom 2010-05-27 13:24:01