|
Boost : |
From: Sascha Seewald (sascha.seewald_at_[hidden])
Date: 2005-11-01 11:46:32
Oh, I had a look at the regression results and found this problem to
be an expected failure on vc-8_0.
A regression note says: "This compiler does not support detection of
const rvalues"
hm... i wonder why I didn't get a compile error or at least some warning?
however, sorry for the noise and keep up the good work!
sascha
Sascha Seewald wrote:
> Hi Boosters!
>
> I've been playing around with BOOST_FOREACH a little and got
> some unexpected results. The following program crashes when
> I try to iterate a const map with BOOST_FOREACH. That's
> really strange because for the non-const map everything
> works fine.
>
> Please take a look at the source. What's wrong here? Did I
> miss something?
>
> This is the version in cvs on vc-8_0.
>
> Cheers
> Sascha
>
>
> -----------------------------------------------------------------
> <source>
>
> #include <boost/foreach.hpp>
> #include <map>
>
> class foo
> {
> public:
> typedef std::map<int, float> map_type;
>
> /// return copy of map
> map_type map() const { return _map; }
>
> /// return const copy of map
> map_type const map_c() const { return _map; }
>
> private:
> map_type _map;
> };
>
>
> void main()
> {
> foo f;
>
> // iterate copy ... ok
> BOOST_FOREACH( foo::map_type::value_type i, f.map() ) {}
>
> // iterate const copy ... crashes here! :-(
> BOOST_FOREACH( foo::map_type::value_type i, f.map_c() ) {}
> }
>
> </source>
>
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk