Boost logo

Boost :

From: Alberto Ganesh Barbati (abarbati_at_[hidden])
Date: 2006-04-29 06:37:04


Shunsuke Sogame ha scritto:
> I note user workaround:
>
> struct xxx : std::vector<int>
> {
> void test()
> {
> foreach(*this);
> }
>
> template< class SelfT >
> void foreach(SelfT& self)
> {
> BOOST_FOREACH (int x, self) {
> }
> }
> };
>

A much simpler workaround that compiles under VC7.1 is:

struct xxx : std::vector<int>
{
    void test()
    {
        xxx* This = this;

        BOOST_FOREACH(int x, *This)
        {
        }
    }
};

HTH,

Ganesh


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk