Skip to content

Cannot create shared_ptr with custom traits value #123

Answered by ColinH
golxzn asked this question in Q&A
Discussion options

You must be logged in to vote

First, this problem has nothing to do with std::shared_ptr. Second, it works for me when I use tao::json::basic_from_string<CustomTraits> instead of tao::json::basic_from_string<custom_trait>.

The type alias custom_trait doesn't add anything, and I'm not really surprised that your example doesn't work given that templated type aliases aren't quite a replacement for class templates like normal type aliases are for classes/types, though I would have expected some different error.

And third, basic_from_file and basic_from_stream also work when using CustomTraits instead of custom_trait. Does this small change work for you, too?

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@golxzn
Comment options

Answer selected by golxzn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants