[fusion-2]: Problems with as_map on empty views

Hi there, I have a slight problem with the construction of a map with fusion::as_map on an empty view: #include <boost/fusion/sequence/class/map.hpp> #include <boost/fusion/sequence/view/filter_view.hpp> #include <boost/fusion/sequence/conversion/as_map.hpp> #include <boost/fusion/core/pair.hpp> struct drop_all {template <typename A> struct apply : boost::mpl::false_ {};}; int main() { using namespace boost::fusion; typedef map<pair<int,int>,pair<float,int>, pair<short,int> > my_map; typedef filter_view<my_map, drop_all> empty_view; typedef meta::as_map<empty_view>::type empty_map; my_map source; empty_view empty_source( source ); empty_map obj( as_map( empty_source) ); } Should I check if the view is empty before running as_map? I had a related problem, which I am right now unable to minimize. Somehow filter and transform views seem to call the meta functions with mpl::void_ and fusion::void_. Regards, Andreas Pokorny

--- Andreas Pokorny <andreas.pokorny@gmx.de> wrote:
Hi there,
I have a slight problem with the construction of a map with fusion::as_map on an empty view:
Should I check if the view is empty before running as_map?
No you should not need to check for empty sequences passed to as_map. This behaviour was caused by a defect in fusion's comparison of the iterators of filter_view. I've checked a fix into cvs and added a test to cover the behaviour. Compiling your example with the latest version then seems to be ok. Thanks for picking this one up!
I had a related problem, which I am right now unable to minimize. Somehow filter and transform views seem to call the meta functions with mpl::void_ and fusion::void_.
Sorry, I'm not sure what you mean here, was this a problem related to the previous example. If not, can you provide a bit more detail please? Cheers Dan ___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com

dan marsden wrote:
--- Andreas Pokorny <andreas.pokorny@gmx.de> wrote:
Hi there,
I have a slight problem with the construction of a map with fusion::as_map on an empty view:
Should I check if the view is empty before running as_map?
No you should not need to check for empty sequences passed to as_map. This behaviour was caused by a defect in fusion's comparison of the iterators of filter_view. I've checked a fix into cvs and added a test to cover the behaviour.
Compiling your example with the latest version then seems to be ok.
Thanks for picking this one up!
Where is fusion-2 checked in? I'd like to port this fix to Boost main CVS. This problem has been bugging me since November, when I first reported it to Joel. -- Eric Niebler Boost Consulting www.boost-consulting.com

--- Eric Niebler <eric@boost-consulting.com> wrote:
Where is fusion-2 checked in? I'd like to port this fix to Boost main CVS. This problem has been bugging me since November, when I first reported it to Joel.
I've added a similar style fix for filter view iterator equality comparison to the fusion1 code in the boost cvs. Hope that helps. The fusion2 code in the spirit cvs on the FUSION_V2 branch if you still need it. Cheers Dan ___________________________________________________________ Yahoo! Exclusive Xmas Game, help Santa with his celebrity party - http://santas-christmas-party.yahoo.net/

dan marsden wrote:
--- Eric Niebler <eric@boost-consulting.com> wrote:
Where is fusion-2 checked in? I'd like to port this fix to Boost main CVS. This problem has been bugging me since November, when I first reported it to Joel.
I've added a similar style fix for filter view iterator equality comparison to the fusion1 code in the boost cvs. Hope that helps.
It does! Thankyouthankyouthankyou. -- Eric Niebler Boost Consulting www.boost-consulting.com

On Mon, Jan 02, 2006 at 10:09:02PM +0000, dan marsden <danmarsden@yahoo.co.uk> wrote:
--- Andreas Pokorny <andreas.pokorny@gmx.de> wrote:
Hi there,
I have a slight problem with the construction of a map with fusion::as_map on an empty view:
Should I check if the view is empty before running as_map?
No you should not need to check for empty sequences passed to as_map. This behaviour was caused by a defect in fusion's comparison of the iterators of filter_view. I've checked a fix into cvs and added a test to cover the behaviour.
Compiling your example with the latest version then seems to be ok.
Thanks for picking this one up!
Thanks for fixing it so fast!
I had a related problem, which I am right now unable to minimize. Somehow filter and transform views seem to call the meta functions with mpl::void_ and fusion::void_.
Sorry, I'm not sure what you mean here, was this a problem related to the previous example. If not, can you provide a bit more detail please?
Just an error message that showed up in conjunction with the error above. Regardas Andreas Pokorny
participants (3)
-
Andreas Pokorny
-
dan marsden
-
Eric Niebler