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

Support for std::shared_ptr arguments #70

Open
jgehring opened this issue Mar 22, 2017 · 2 comments
Open

Support for std::shared_ptr arguments #70

jgehring opened this issue Mar 22, 2017 · 2 comments

Comments

@jgehring
Copy link

jgehring commented Mar 22, 2017

I've been trying to declare constructors and functions that take std::shared_ptr<U> argument, where U is a type that has been previously declared via ponder::Class::declare<U>. A small example test case is here. However, I'm running into template issues like the following:

In file included from test_ponder.cpp:2:
In file included from /usr/local/include/ponder/class.hpp:37:
In file included from /usr/local/include/ponder/property.hpp:35:
In file included from /usr/local/include/ponder/tagholder.hpp:36:
In file included from /usr/local/include/ponder/value.hpp:38:
/usr/local/include/ponder/detail/valueimpl.hpp:53:16: error: no viable conversion from returned value of type 'Test1' to function return type 'std::__1::shared_ptr'
return ponder_ext::ValueMapper::from(value);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ponder/detail/variant.hpp:316:20: note: in instantiation of function template specialization 'ponder::detail::ConvertVisitor<std::__1::shared_ptr >::operator()' requested
here
return f(unwrapper::apply_const(v.template get_unchecked()));
[...]

I'm wondering whether I'm doing something wrong or whether there's missing support for smart pointer arguments.

@billyquith
Copy link
Owner

I think this is probably a problem with Ponder not supporting smart pointers. Related to #41.

I'd suggest just using normal ones until I get round to looking at this (which may not be soon as I have little spare time at the moment).

@jgehring
Copy link
Author

Ok, thanks! I think the issue is that the ValueMapper trait for smart pointers simply forwards the underlying type. I'd guess that the from functions would need to be reimplemented, but without further knowledge of ponder's internals I'm not sure what the right way to do this would be.

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

No branches or pull requests

2 participants