m****e 发帖数: 37 | 1 用Allocate_2DArray函数分配空间,在函数内部,pArray2D一直没问题,可是返回的
pCostMatrix确是NULL,有什么方法可以解决问题?多谢。
double** pCostMatrix = NULL;
bSuccess = Allocate_2DArray(100, 100, pCostMatrix);
template
Logical Allocate_2DArray(Int32 lWidth, Int32 lHeight, T** pArray2D)
{
bool bSuccess = true;
pArray2D = NULL;
try {
pArray2D = new T*[lWidth];
}
catch(...) {
IMSMessageAlert("Insufficient memory ");
}
bSuccess = (pArray2D != NULL);
if(bSuccess) {
for(Int32 lWidthIndex = 0; lWidthIndex < | r*******y 发帖数: 290 | 2 typedef T** YOUR_TYPE
You pass in a YOUR_TYPE variable pCostMatrix, its value is not changed
the copy of the variable is changed, which is pArray2D
【在 m****e 的大作中提到】 : 用Allocate_2DArray函数分配空间,在函数内部,pArray2D一直没问题,可是返回的 : pCostMatrix确是NULL,有什么方法可以解决问题?多谢。 : double** pCostMatrix = NULL; : bSuccess = Allocate_2DArray(100, 100, pCostMatrix); : template : Logical Allocate_2DArray(Int32 lWidth, Int32 lHeight, T** pArray2D) : { : bool bSuccess = true; : pArray2D = NULL; : try {
| m****e 发帖数: 37 | 3 How can I make the value of pCostMatrix changed? Can I use reference in this
case? thanks
【在 r*******y 的大作中提到】 : typedef T** YOUR_TYPE : You pass in a YOUR_TYPE variable pCostMatrix, its value is not changed : the copy of the variable is changed, which is pArray2D
| P********e 发帖数: 2610 | 4 程序写怎么好,还问这种问题?
template
Logical Allocate_2DArray(Int32 lWidth, Int32 lHeight, T**& pArray2D)
用Allocate_2DArray函数分配空间,在函数内部,pArray2D一直没问题,可是返回的
pCostMatrix确是NULL,有什么方法可以解决问题?多谢。
double** pCostMatrix = NULL;
bSuccess = Allocate_2DArray(100, 100, pCostMatrix);
template
Logical Allocate_2DArray(Int32 lWidth, Int32 lHeight, T** pArray2D)
{
bool bSuccess = true;
pArray2D = NULL;
try {
pArray2D = new T*[lWidth];
}
catch(...) {
IMSMessageAlert("Insufficient m
【在 m****e 的大作中提到】 : 用Allocate_2DArray函数分配空间,在函数内部,pArray2D一直没问题,可是返回的 : pCostMatrix确是NULL,有什么方法可以解决问题?多谢。 : double** pCostMatrix = NULL; : bSuccess = Allocate_2DArray(100, 100, pCostMatrix); : template : Logical Allocate_2DArray(Int32 lWidth, Int32 lHeight, T** pArray2D) : { : bool bSuccess = true; : pArray2D = NULL; : try {
|
|