Last active
May 30, 2016 10:26
-
-
Save uliwitness/c7696c5074de10958f14f0a99c2020fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct eat_char_fcn | |
{ | |
eat_char_fcn( struct eat_char_fcn (*inFun)( char currCh, xml_reader& reader, vector<shared_ptr<node>>& nod, attribute* att ) ) : function(inFun) {} | |
struct eat_char_fcn operator()( char currCh, xml_reader& reader, vector<shared_ptr<node>>& nod, attribute* att ) { return function(currCh,reader,nod,att); } | |
explicit operator bool() { return function != nullptr; } | |
struct eat_char_fcn (*function)( char currCh, xml_reader& reader, vector<shared_ptr<node>>& nod, attribute* att ); | |
}; |
Note: Got a suggestion to make the operator bool explicit, which should prevent nasty accidental bool conversions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could even make this a macro like: