矢量和Carray之间的区别 [英] Difference between vector and Carray

查看:89
本文介绍了矢量和Carray之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

std :: vector< mtpoint2d> m_Points;



CArray< MtPoint2d,Mtpoint2d> m_Points





以上声明是否相同?



如果我给std :: vector< mtpoint2d mtpoint2d => m_Points;作为CArray它给我错误...



请让我知道

解决方案

std :: vector CArray 是两个不同的容器。它们可能服务于相同的目的,但它们不可互换(它们的公共接口不同)。如果可以,请使用 std :: vector ,因为它更好。



[update]

您也可以使用

 CArray< MtPoint2d,MtPoint2d> 



或a

 std :: vector< MtPoint2d> 





出于同样目的。

[/ update]


 CArray <     class        class    >  point 

A类:: A(const A& point2Array)
{

point.Copy(point2Array.m_Points); //使用Carray

如何处理向量
}







请让我知道如何处理vector


std::vector <mtpoint2d> m_Points;

CArray < MtPoint2d , Mtpoint2d > m_Points


are both the above declartions are same?

if i give std::vector <mtpoint2d mtpoint2d=""> m_Points; as CArray its giving me error ...

Please let me know

解决方案

The std::vector and the CArray are two different containers. They may server the same purpose, however they are not interchangeable (their public interface is different). If you can, use std::vector, since it is better.

[update]
You may alternatively use a

CArray < MtPoint2d, MtPoint2d > 


or a

std::vector < MtPoint2d > 



for the same purpose.
[/update]


CArray < class , class > point

Class A::A(const A &point2Array)
{

    point.Copy(point2Array.m_Points); //working with Carray

    how to do with vector
}




please let me know how to do with vector


这篇关于矢量和Carray之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆