You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
int main()
{
// Start a ZK server running on localhost (not needed if you just want a client, but great for testing and
// demonstration purposes).
zk::server::server server(zk::server::configuration::make_minimal("zk-data", 2181));
// zk::client::connect returns a future<zk::client>, which is delivered when the connection is established.
auto client = zk::client::connect("zk://127.0.0.1:2181").get();
// get_result has a zk::buffer and zk::stat.
client.get("/foo/bar").then(print_thing<zk::get_result>);
return 0x00;
}
Compile Error: test.cpp: In function ‘int main()’: test.cpp:37:28: error: ‘zk::future<zk::get_result> {aka class std::future<zk::get_result>}’ has no member named ‘then’ client.get("/foo/bar").then(print_thing<zk::get_result>);
thanks a lot!
The text was updated successfully, but these errors were encountered:
The then function comes from the proposed std::experimental::future::then, which is still not in C++17. I was hoping the C++ Standard would catch up to my documentation. In the future, there will be a workaround to set ZKPP_FUTURE_USE_STD_EXPERIMENTAL to 1. This requires two changes:
When building the library, cmake -DZKPP_BUILD_SETTING_FUTURE=STD_EXPERIMENTAL ..
When using it in your own project, #define ZKPP_FUTURE_USE_STD_EXPERIMENTAL 1
NOTE: This will not work unless you have <experimental/future> implemented by your Standard Library implementation, which I don't know of any implementation this is true in. boost::future has a then implementation, but I haven't added ZKPP_BUILD_SETTING_FUTURE=BOOST_THREAD equivalent (yet).
Sorry for bumping this old issue, but I'm facing the same problem. I saw that PR #112 was merged, but I can't figure out on how to use the .then of boost, since it seems to expect more than one argument.
Is there a minimal working example anywhere?
Sorry for bumping this old issue, but I'm facing the same problem. I saw that PR #112 was merged, but I can't figure out on how to use the .then of boost, since it seems to expect more than one argument. Is there a minimal working example anywhere?
Env:
Code:
Compile Command:
g++ --std=c++17 -I ~/github/zookeeper-cpp/src/ test.cpp
Compile Error:
test.cpp: In function ‘int main()’: test.cpp:37:28: error: ‘zk::future<zk::get_result> {aka class std::future<zk::get_result>}’ has no member named ‘then’ client.get("/foo/bar").then(print_thing<zk::get_result>);
thanks a lot!
The text was updated successfully, but these errors were encountered: