Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using use for creating modular routes results in errors. #35

Open
scm-ns opened this issue Jun 9, 2020 · 0 comments
Open

Using use for creating modular routes results in errors. #35

scm-ns opened this issue Jun 9, 2020 · 0 comments

Comments

@scm-ns
Copy link

scm-ns commented Jun 9, 2020

I use the following code to create a modular route.

http::basic_router<http_session> router{std::regex::ECMAScript};

http::basic_router<http_session> router__{std::regex::ECMAScript};

router__.get(R"(^/$)", [](http_request beast_http_request, http_context context) {
    context.send(make_200<beast::http::string_body>(beast_http_request, "Main page\n", "text/html"));
});
router.use(R"(/animal$)", router__);

I get this error :

bazel-out/darwin-fastbuild/bin/external/beast_http/_virtual_includes/beast_http/http/base/impl/router.hxx:64:28: error: indirection requires pointer operand ('const _0xdead4ead::http::base::cb::storage<_0xdead4ead::http::reactor::session<boost::beast::http::basic_string_body<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::beast::http::parser<true, boost::beast::http::basic_string_body<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<char> >, boost::beast::http::serializer<false, boost::beast::http::basic_string_body<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::beast::http::basic_fields<std::__1::allocator<char> > >, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, boost::asio::ip::tcp, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::chrono::steady_clock, boost::asio::basic_waitable_timer<std::__1::chrono::steady_clock, boost::asio::wait_traits<std::__1::chrono::steady_clock>, boost::asio::executor>, std::function, std::vector, std::map, std::unordered_map, std::function, std::function>, function, vector>' invalid) auto storage = *value.second; ^~~~~~~~~~~~~ bazel-out/darwin-fastbuild/bin/external/beast_http/_virtual_includes/beast_http/http/basic_router.hxx:368:20: note: in instantiation of member function '_0xdead4ead::http::base::router<_0xdead4ead::http::reactor::session<boost::beast::http::basic_string_body<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::beast::http::parser<true, boost::beast::http::basic_string_body<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<char> >, boost::beast::http::serializer<false, boost::beast::http::basic_string_body<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::beast::http::basic_fields<std::__1::allocator<char> > >, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, boost::asio::ip::tcp, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::chrono::steady_clock, boost::asio::basic_waitable_timer<std::__1::chrono::steady_clock, boost::asio::wait_traits<std::__1::chrono::steady_clock>, boost::asio::executor>, std::function, std::vector, std::map, std::unordered_map, std::function, std::function> >::use' requested here base_type::use(path_to_resource, other); ^ src/server.cpp:21:12: note: in instantiation of member function '_0xdead4ead::http::basic_router<_0xdead4ead::http::reactor::session<boost::beast::http::basic_string_body<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::beast::http::parser<true, boost::beast::http::basic_string_body<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<char> >, boost::beast::http::serializer<false, boost::beast::http::basic_string_body<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::beast::http::basic_fields<std::__1::allocator<char> > >, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, boost::asio::ip::tcp, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::chrono::steady_clock, boost::asio::basic_waitable_timer<std::__1::chrono::steady_clock, boost::asio::wait_traits<std::__1::chrono::steady_clock>, boost::asio::executor>, std::function, std::vector, std::map, std::unordered_map, std::function, std::function> >::use' requested here router.use(R"(/animal$)", router__); ^ In file included from src/server.cpp:1: In file included from src/utils.hpp:4: In file included from bazel-out/darwin-fastbuild/bin/external/beast_http/_virtual_includes/beast_http/http/basic_router.hxx:4: In file included from bazel-out/darwin-fastbuild/bin/external/beast_http/_virtual_includes/beast_http/http/base/router.hxx:110: bazel-out/darwin-fastbuild/bin/external/beast_http/_virtual_includes/beast_http/http/base/impl/router.hxx:76:32: error: indirection requires pointer operand ('const _0xdead4ead::http::base::cb::storage<_0xdead4ead::http::reactor::session<boost::beast::http::basic_string_body<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::beast::http::parser<true, boost::beast::http::basic_string_body<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<char> >, boost::beast::http::serializer<false, boost::beast::http::basic_string_body<char, std::__1::char_traits<char>, std::__1::allocator<char> >, boost::beast::http::basic_fields<std::__1::allocator<char> > >, boost::beast::basic_flat_buffer<std::__1::allocator<char> >, boost::asio::ip::tcp, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::chrono::steady_clock, boost::asio::basic_waitable_timer<std::__1::chrono::steady_clock, boost::asio::wait_traits<std::__1::chrono::steady_clock>, boost::asio::executor>, std::function, std::vector, std::map, std::unordered_map, std::function, std::function>, function, vector>' invalid) auto storage = *value_r.second;

Essentially it looks like line :

auto storage = *value_r.second;
is causing some issue.

C++ 11; Bazel; Mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant