← 输入框|github.com|刷新
Skip to content

compilation error with ready(response) #683

Open

Description

@dvd0101
#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

  1. deanberris commented on Sep 15, 2016

    @deanberris
    Member

    What version of the library are you using? Is it 0.12.0 or 0.11.2?

  2. dvd0101 commented on Sep 15, 2016

    @dvd0101
    Author

    Argh, I forget to mention it; I'm using the last one: 0.12.0

  3. deanberris commented on Sep 15, 2016

    @deanberris
    Member

    0.12.0 requires C++11 now, so if you're building your application you would need to either explicitly set -std=c++11 in 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?

  4. dvd0101 commented on Sep 15, 2016

    @dvd0101
    Author

    Sorry I forget to include the compiler invocation:

    g++ -DBOOST_NETWORK_ENABLE_HTTPS -DBOOST_USE_STATIC_LIBS  -std=c++14 -g -Wall -Wextra -pthread -c main.cpp
    

    gcc: g++ (Ubuntu 6.2.0-3ubuntu14) 6.2.0 20160910
    cppnet: 0.12.0

  5. deanberris commented on Sep 15, 2016

    @deanberris
    Member

    I see -- yeah, this was an issue with the transition from Boost.Thread's implementation of shared_future which has a member called is_ready as opposed to the one the standard adopted in C++11 which is called valid (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_future there too.

    The other option is to use 0.11.2 which shouldn't have this problem but relies on Boost.Thread's implementation instead.

  6. dvd0101 commented on Sep 15, 2016

    @dvd0101
    Author

    I'm going to do a test with the 0.13-release branch; I'll report the result.

    BTW IIUC std::future<>::valid checks 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 for boost::future<>::is_ready.

  7. dvd0101 commented on Sep 16, 2016

    @dvd0101
    Author

    @deanberris same problem with the 0.13-release branch

  8. dvd0101 commented on Sep 16, 2016

    @dvd0101
    Author

    @deanberris @glynos a mechanical substitution of all the occurrences of std::shared_future and std::promise into the boost equivalents seems to work.

    All tests pass on a fresh build.

    Are you interested in a PR?

  9. glynos commented on Sep 17, 2016

    @glynos
    Member

    @cinghiale I would be happy to make time to review your PR.

  10. self-assigned this
    on Oct 14, 2016
  11. added this to the 0.13 milestone on Oct 14, 2016
  12. glynos commented on Oct 14, 2016

    @glynos
    Member

    @cinghiale Can I close this?

  13. dvd0101 commented on Oct 15, 2016

    @dvd0101
    Author

    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?

  14. modified the milestones: 1.0, 0.13 on Oct 15, 2016
  15. carun commented on Feb 4, 2018

    @carun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions