
Thanks, I saw this a long time ago at codeproject also. Is there any real hope in the future that boost::any will take advantage of this implementation? This is related to my original question. While using hold_any, I run into this problem when trying to use BOOST_SPIRIT_DEBUG with a vector of hold_any. binary '>>' : no operator found which takes a right-hand operand of type 'std::vector<_Ty>' (or there is no acceptable conversion) 1> with 1> [ 1> _Ty=boost::spirit::hold_any 1> ] The code I added was as follows std::istream& operator>> (std::istream& i, vector<hold_any>& obj) { return i;//obj.table->stream_in(i, &obj.object); } std::ostream& operator<< (std::ostream& o, vector<hold_any> const& obj) { o << "["; for(size_t i = 0; i < obj.size(); i++) { if(i > 0) o << ","; o << obj[i]; } o << "]"; return o; } -----Original Message----- From: spirit-general-bounces@lists.sourceforge.net [mailto:spirit-general-bounces@lists.sourceforge.net] On Behalf Of Hartmut Kaiser Sent: Friday, July 13, 2007 10:01 AM To: 'Spirit General Mailing List' Subject: Re: [Spirit-general] Spirit Questions Joel de Guzman wrote:
*Question #3 of 3: How do I debug using '#define BOOST_SPIRIT_DEBUG' when using closures with a member of any?*
Any needs stream operators which it doesn't have. I know this may be an idiot question but I am asking it anyway because I tried the following 2 and could get neither to work. Any assistance would be appreciated.
Well, this is outside the scope of Spirit. I think the proper forum in this case is, back to the boost list -- just for this particular case. If I were you, I'd use a boost.variant instead and use its visitation mechanism to print its contents. There's really no fool proof way to print a boost any's contents.
FWIW, Spirit2 contains a hold_any class which is: A) faster than Boost.Any, B) supports input/output streaming as long as the elements stored in the hold_any do support streaming as well, C) is otherwise 100% compatible to Boost.Any. Regards Hartmut (BTW, it's here: http://tinyurl.com/242kyt) ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Spirit-general mailing list Spirit-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spirit-general