Repository navigation
Open
Milestone
Description
#include <boost/network/include/http/client.hpp>
int main() {
using namespace boost::network;
using namespace boost::network::http;
client c;
client::request req{"http://github.com"};
auto resp = c.get(req);
auto check = ready(resp);
}this code fails to compile with g++ (Ubuntu 6.2.0-3ubuntu14) 6.2.0 20160910
The compiler output is (path shortened):
.../include/boost/network/protocol/http/message/wrappers/ready.hpp: In instantiation of ‘boost::network::http::impl::ready_wrapper<Tag>::operator bool() [with Tag = boost::network::http::tags::http_async_8bit_udp_resolve]’:
.../include/boost/network/protocol/http/message/wrappers/ready.hpp:38:42: required from ‘bool boost::network::http::ready(const boost::network::http::async_message<Tag>&) [with Tag = boost::network::http::tags::http_async_8bit_udp_resolve]’
/home/dvd/Projects/personal/rg/ck/main.cpp:10:25: required from here
.../include/boost/network/protocol/http/message/wrappers/ready.hpp:27:44: error: ‘class std::shared_future<std::__cxx11::basic_string<char> >’ has no member named ‘is_ready’
return wrapper_base::_message.version_.is_ready() &&
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
.../include/boost/network/protocol/http/message/wrappers/ready.hpp:28:43: error: ‘class std::shared_future<short unsigned int>’ has no member named ‘is_ready’
wrapper_base::_message.status_.is_ready() &&
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
.../include/boost/network/protocol/http/message/wrappers/ready.hpp:29:51: error: ‘class std::shared_future<std::__cxx11::basic_string<char> >’ has no member named ‘is_ready’
wrapper_base::_message.status_message_.is_ready() &&
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
.../include/boost/network/protocol/http/message/wrappers/ready.hpp:30:44: error: ‘class std::shared_future<std::multimap<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>, boost::network::impl::is_less_ignore_case_impl> >’ has no member named ‘is_ready’
wrapper_base::_message.headers_.is_ready() &&
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
.../include/boost/network/protocol/http/message/wrappers/ready.hpp:31:41: error: ‘class std::shared_future<std::__cxx11::basic_string<char> >’ has no member named ‘is_ready’
wrapper_base::_message.body_.is_ready();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
according to cppreference is_ready is part of the new concurrency TS
any workaround?
Activity
deanberris commentedon Sep 15, 2016
What version of the library are you using? Is it 0.12.0 or 0.11.2?
dvd0101 commentedon Sep 15, 2016
Argh, I forget to mention it; I'm using the last one: 0.12.0
deanberris commentedon Sep 15, 2016
0.12.0 requires C++11 now, so if you're building your application you would need to either explicitly set
-std=c++11in your command line flags, and use an up-to-date STL implementation with it. Please try that first and see whether that fixes the issue?dvd0101 commentedon Sep 15, 2016
Sorry I forget to include the compiler invocation:
gcc:
g++ (Ubuntu 6.2.0-3ubuntu14) 6.2.0 20160910cppnet: 0.12.0
deanberris commentedon Sep 15, 2016
I see -- yeah, this was an issue with the transition from Boost.Thread's implementation of
shared_futurewhich has a member calledis_readyas opposed to the one the standard adopted in C++11 which is calledvalid(seen here).I'm not sure what @glynos' timeline is for a 0.13 release, but we've switched back to using Boost.Asio there -- and we may be able to revert to using Boost.Thread's
shared_futurethere too.The other option is to use 0.11.2 which shouldn't have this problem but relies on Boost.Thread's implementation instead.
dvd0101 commentedon Sep 15, 2016
I'm going to do a test with the 0.13-release branch; I'll report the result.
BTW IIUC
std::future<>::validchecks if the internal state of the future is valid (ie. if it is not moved) not if it is ready. The std library has not replacement forboost::future<>::is_ready.dvd0101 commentedon Sep 16, 2016
@deanberris same problem with the
0.13-releasebranchdvd0101 commentedon Sep 16, 2016
@deanberris @glynos a mechanical substitution of all the occurrences of
std::shared_futureandstd::promiseinto the boost equivalents seems to work.All tests pass on a fresh build.
Are you interested in a PR?
glynos commentedon Sep 17, 2016
@cinghiale I would be happy to make time to review your PR.
glynos commentedon Oct 14, 2016
@cinghiale Can I close this?
dvd0101 commentedon Oct 15, 2016
I'm working on the PR to bring these fixes on the master branch. Can we wait to close this until also the master is ok?
carun commentedon Feb 4, 2018
ping @cinghiale