Skip to content

Fix issue resolving const dependencies#54

Open
JonathanHiggs wants to merge 1 commit intoybainier:masterfrom
JonathanHiggs:bugfix/resolve-const-ptr
Open

Fix issue resolving const dependencies#54
JonathanHiggs wants to merge 1 commit intoybainier:masterfrom
JonathanHiggs:bugfix/resolve-const-ptr

Conversation

@JonathanHiggs
Copy link

Ran into an issue trying to resolve a std::shared_ptr<const ...> as an autowired dependency. I don't know whether this was intentional or not, but I believe resolving const dependencies is a legitimate usecase

The issue was that the existing ArgumentResolver specialization would try specialize where TArg included the const and this could not cast to std::shared_ptr<void> without loss of const qualification

To fix I have added an overload of ArgumentResolver that specializes for const types; it resolves the non-const type and converts to const after that. There are two test cases that fail without the new specialization and pass with it

Let me know if there are any changes you would need to accept this PR

Thanks

@shoheikuni shoheikuni mentioned this pull request Jun 11, 2023
@shoheikuni
Copy link

Hi. I wanted to deal with the same issue and pushed another solution to #55.

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

Successfully merging this pull request may close these issues.

2 participants