Friday, February 11, 2022

example code

 #include <iostream>

#include <vector>

using namespace std;


typedef struct _AppsData

{

    _AppsData(const _AppsData &) = default;

    _AppsData() = default;

    void clear() {

        cout << "AppsData clear" << endl;

        appId = "String APP ID";

    }

    int operator == (struct _AppsData & appData) {

      std::string tagAppId;

      tagAppId = appData.appId;

      cout << "_AppsData operator == appData:" << tagAppId << endl;

      return 0;

    }

    struct _AppsData & operator = (struct _AppsData & appData) {

      cout << "_AppsData operator=" << endl;

      appId = appData.appId;

      return *this;

    }

    std::string appId;

} AppsData;


typedef struct _APPInfo

{

    std::string strAppCRID;


}APPInfo, *PAPPInfo;


int test1(const std::string appid)

{

    std::vector<AppsData>::iterator cc;

    if(appid.size() == 0) {

      cout << "appid size = 0" << endl;

    }

    return 0;

}


int main()

{

   

    bool b = false;

    PAPPInfo    pAppInfo;

    AppsData appData;

    cout << "Start main" << endl;

    appData.clear();

    cout << "Do pAppInfo->strAppCRID appData.appId:" << appData.appId << endl;

    pAppInfo->strAppCRID = appData.appId;

    cout << "Start test1" << endl;

    b = !(bool)test1(std::string(pAppInfo->strAppCRID));

    cout << "end b" << b;

    return 0;

}

No comments:

Post a Comment

n8n index

 【n8n免費本地端部署】Windows版|程式安裝x指令大補帖  【一鍵安裝 n8n】圖文教學,獲得無限額度自動化工具&限時免費升級企業版功能