You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some background information: I was trying to use fmt alongside docopt, but as far as I am aware the parsed values cannot be "unconditionally" converted to string-like objects; docopt::value::toXXXX functions throw when the type don't match, and the operator<< overload requires that I use std::ostream (and std::stringstream), which is not an easy one-line solution.
It would be ideal if in the implementation instead of overloading operator<<, a noexcept version of represent function is provided that converts the underlying value with whatever type into a string-like object. Then if providing an operator<< is absolutely necessary, mark the overload inline that simply calls represent.
The text was updated successfully, but these errors were encountered:
So you are asking to have the to-string functionality be a member function rather than a global? Would 'represent' return a std::string? One benefit of << is that it doesn't require the creation of a string.
Some background information: I was trying to use fmt alongside docopt, but as far as I am aware the parsed values cannot be "unconditionally" converted to string-like objects;
docopt::value::toXXXX
functions throw when the type don't match, and theoperator<<
overload requires that I usestd::ostream
(andstd::stringstream
), which is not an easy one-line solution.It would be ideal if in the implementation instead of overloading
operator<<
, a noexcept version ofrepresent
function is provided that converts the underlying value with whatever type into a string-like object. Then if providing anoperator<<
is absolutely necessary, mark the overload inline that simply callsrepresent
.The text was updated successfully, but these errors were encountered: