c++ - How to pass pointer to CURL in struct to vector? -


curl * myhandle; (... operations) std::vector<curl_a> * crl = &program_data::getinstance().curl_acc[80]; crl->push_back({ myhandle,true }); //look @ bottom 

struct of push_back seems that:

struct curl_a {     curl_a(){};     curl_a(curl * d, int &l) :data(d), logged(l){};     curl * data;     bool logged; }; 

//header.h (singleton pattern)

std::unordered_map <int, std::vector<curl_a>> curl_acc; 

and tell me now, why push_back dont work ? compilator return error structs.h (with struct above)

curl_a' : illegal member initialization: 'data' not base or member 

the issue seems calling curl_a constructor invalid second argument. passing true when parameter wants l-value (reference).

instead of initializing value of true, use integer variable.

int x = 1; crl->push_back({ myhandle, x });  

here example, simplified using int* instead of curl*: http://ideone.com/szxesi

here example using failed attempt of using true parameter: http://ideone.com/hqtaau


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -