-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2014-03-10 08:26, Oliver Kowalke wrote:
2014-03-10 1:37 GMT+01:00 Brian Ravnsgaard Riis
mailto:brian@ravnsgaard.net>: [&](coroutine<char>::pull_type& c) { content.push_back(c.get()); while(content.size() != contentLength) { c(); content.push_back(c.get()); } validResult = true; }
before calling c.get() you should test if a value is available from pull_type, e.g. 'if(c) x=c.get()'
Hi Oliver, thanks for replying. Maybe I should've mentioned that I only call the push_type if there's anything left in the buffer: while(begin != end && !validResult) { parser(*begin++) } "parser" is the push_type, obviously; begin and end are iterators into the buffer I'm parsing. Anyway, I quickly tried to add the check in the coroutine as well, but that did not change anything. I didn't expect it to, as *I never call the push_type anyway!* If I "merge" the above push_type with the one I use for parsing the message header and just re-use that, then the assertion also does not trigger. The problem seems to be that the push_type is initialised with the lambda but then never called. Will experiment a bit more... /Brian -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJTHXH6AAoJEFES4N8QrEodTaQH/3SsIb7W9qbIMndqIAOB9viP xHZ2XSN/bReMKw0+51QlfKPrMMijL8Ul3/EPCWJKI7iFgbUUDXnGOJ8M2k9q+NCI 7eW4FoJtPCMxfBRkjxOfZWua64qr8UhDi6b16+u41+ddkmCB/arrC/6w5lJPkco0 psx/hY3AQMtA6Nn/b2BoiXze32n7z5NL9lxb4ebyyZ3sbUHfB6m9nvdgDWZvloMY 3on31hwrkClnH8N8areksAfN1MzY/PPYkX7ziztssqjj90LNFBFhThK/uJBNBDc6 +6St8ROuMThJVSq8NydVsPgUtRTnvv7ULrnPbYA9rF5Xw8c+40KYUE6o79MMJm0= =QbCx -----END PGP SIGNATURE-----