栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

c++结构体开内存

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

c++结构体开内存

main.cpp

int process_lpr(vector, shared_ptr, vector &);
vector plates;
process_lpr(images,  engine, plates);    

a.cpp

int process_lpr(vector images, shared_ptr engine, vector &plates)
{
    for(int b=0;b
        pr::plate returnRes=plates[b];
                if(plate_lenghth==7){
            returnRes.nameList=single_name;
            returnRes.confList=single_confid;
            returnRes.length = plate_lenghth;
            returnRes.name =name ;
            returnRes.confidence = sum_confidence/plate_lenghth;
            printf("length=%d,name=%s,confidence=%fn", returnRes.length, returnRes.name.c_str(),returnRes.confidence);
        for(int i=0; i
            printf("namelist_%d=%s,score=%fn", i, returnRes.nameList[i].c_str(),returnRes.confList[i]);
        }
        }

这样在main.cpp和a.cpp中都没有开内存,会报断错误。
解决方法一:
修改a.cpp

int process_lpr(vector images, shared_ptr engine, vector &plates)
{
    for(int b=0;b
        pr::plate returnRes;      //在这里开内存
        if(plate_lenghth==7){
            returnRes.nameList=single_name;
            returnRes.confList=single_confid;
            returnRes.length = plate_lenghth;
            returnRes.name =name ;
            returnRes.confidence = sum_confidence/plate_lenghth;
            printf("length=%d,name=%s,confidence=%fn", returnRes.length, returnRes.name.c_str(),returnRes.confidence);
        for(int i=0; i
            printf("namelist_%d=%s,score=%fn", i, returnRes.nameList[i].c_str(),returnRes.confList[i]);
        }
         plates.push_back(returnRes);
        }
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/847863.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号