Replies: 4 comments 1 reply
-
get returns a temporary, and then using c_str is not safe. Use get_ref instead. |
Beta Was this translation helpful? Give feedback.
-
But then passing that c_str should make a copy? I mean, if get returns a temporary...and thus is not safe...then why would it be safe to store the returned string in a string for keeping? |
Beta Was this translation helpful? Give feedback.
-
Also, there doesn't even seem to be a 'get_ref' function, or at least, not as a drop in replacement. I am on the latest stable version...
I checked the json header and the get_ref function seems to be in there but I'm clearly too inept to grok/use it. |
Beta Was this translation helpful? Give feedback.
-
I found the actual documentation in the meantime, and I now realize that with get_ref I actually have to request a ref (ampersand) Closing this issue. |
Beta Was this translation helpful? Give feedback.
-
Showing the example would be too much of a hassle...but
Instead of
was the only way I could end up with some weird mangled strings that were okay as a
'gotten' std::string or a dumped one.
But not as a daisy chained c_str() one, yet, they still worked when done in two steps.
I know I could probably be more helpful, but I'm a bit frustrated, worn out, dazzled, discombobulated and other things from several plates of programming BS I had to eat today.
Does template metaprogramming mess with 'syntactic sugar' (if it really is that) ?
Shouldn't these two operations be, under the hood, the same thing?
Why would "Environmental Suit" as a value for
name
, not work when daisy chain converted, but "Kenneth" or "Chicken Chicken bok bok bok" did?This makes NO sense to me whatsoever...and I actually feel like crying a lil right now.
Beta Was this translation helpful? Give feedback.
All reactions