简体   繁体   中英

how to set a flag (cpp-netlib)

I think my question is really trivial, but I can't get it to work nonetheless

std::string url="www.google.it";

boost::network::http::client client1_(_follow_redirects=true, _cache_resolved=true);
boost::network::http::client::request req(url);
boost::network::http::client::response resp = client1_.get(req);
std::cout << "Body: " << body(resp) << std::endl;

return 0;

the error of course refers to the declaration of the flags...but how can I set them?

/home/snake91/cpp_pricing/underlying.cpp:67: error: C++ requires a type specifier for all declarations
    boost::network::http::client client1_(_follow_redirects=true, _cache_resolved=true);

^
client::options options;
options.follow_redirects(true)
       .cache_resolved(true);

client client1_(options);

From this page of the docs: http://cpp-netlib.org/0.11.0/reference/http_client.html#general

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM