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

Enable "custom" tostring operators #9

Open
rpavlik opened this issue Mar 20, 2012 · 0 comments
Open

Enable "custom" tostring operators #9

rpavlik opened this issue Mar 20, 2012 · 0 comments

Comments

@rpavlik
Copy link

rpavlik commented Mar 20, 2012

In cases where an existing operator<< doesn't exist or is unsuitable for use in this way, it would be good to be able to optionally pass a function, taking a (reference/const reference/pointer/pointer to const) and returning a string.

Right now this can kind of be "hacked" into place with something like this above the binding:

namespace luabind {
    static inline std::string tostring_operator(CLASSNAME const& val) {
         /// your code here
         return s;
    }
}

which will be preferentially selected over the function template in operators.hpp, but it's not pretty or particularly expressive.

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

No branches or pull requests

1 participant