The Wayback Machine - https://web.archive.org/web/20201021123634/https://github.com/pocoproject/poco/issues/2792
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

Documentation Error regarding Dynamic Var and Object::getValue #2792

Open
bridgewaterrobbie opened this issue Sep 22, 2019 · 0 comments
Open

Documentation Error regarding Dynamic Var and Object::getValue #2792

bridgewaterrobbie opened this issue Sep 22, 2019 · 0 comments

Comments

@bridgewaterrobbie
Copy link

@bridgewaterrobbie bridgewaterrobbie commented Sep 22, 2019

The documentation for Object, Var and Varholder lead me to believe that given the following setup:

std::vector<DynamicStruct> testList;
  Object t1;
  t1.set("name","com.tl");
  t1.set("num1",false);
  Object j;
  j.set("testval",testList);

The following call would let me extract the values (similar to my other use of Object with primitives and basic strings)

auto retBack = j.getValue<std::vector<DynamicStruct>>("testval");

However, this results in a compile-time failure of no matching member function for call to 'convert. Simplifying this to only be setting a DynamicStruct and getting the same still results in the same compile time failure.

I am aware that I can extract the values by doing the following:

auto testBack = j.get("testval");

  auto extract = testBack.extract<std::vector<DynamicStruct>>();

But the current documentation does not make this fact clear.

In my opinion, ideally auto retBack = j.getValue<std::vector<DynamicStruct>>("testval"); would be valid but failing that the documentation for getValue should clarify it's limitations, and point users of DynamicStruct and Vectors (Which are valid vars per Varholder documentation) to the second method, which works fine.

(I'd like to note that I really appreciate what Poco provides, I'm just wanting to help future users of it who might run into this)

@pocoproject pocoproject deleted a comment Jan 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.