c++ - Getting value from a pair fails with: TYPENAME does not provide a call operator -


here want do. want store de data http response, headers , data. figured easy way store response , data pair. data fetched lru-cache. lru cache takes key(string) , pair. httpresponse in form of poco c++ httpresponse object. cant string second argument of pair!

        this->clientcache = new lrupersistentcache<string, pair<httpresponse, string > >(3,cachepath);        pair<httpresponse,string> tmp = (*this->clientcache->get(headkey));// pair     cout << ((string*)tmp.second()).c_str();  //should second object of pair! // gives: type std::basic_string<char> not provide call operator. 

writing below gives same error:

            cout << (*this->clientcache->get(headkey)).second().c_str(); 

what doing wrong here?

cout << ((string*)tmp.second()).c_str();                  ^^ 

you casting string*. should string (or nothing @ all) because second of pair<httpresponse,string> string.

and second member not member function should tmp.second


cout << tmp.second.c_str();  

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -