Boost logo

Boost Users :

From: Schalk_Cronje_at_[hidden]
Date: 2004-10-15 07:00:48


> I wonder why gcc is able to compile it. :-)

Well considering that the following also yields different results on MSVC7.1 and gcc 3.2/3.3 I would wonder if there is a problem with one of the compilers

#include <iostream>
#include <boost/bind.hpp>

        struct X
        {
                void f() {std::cout << "None" << std::endl;}
                void f() const {std::cout << "const" << std::endl;}
        };

        template <typename T>
        void
        run( void (T::*f_)(), T& t_)
        {(t_.*f_)();}

        template <typename T>
        void
        run( void (T::*f_)() const, T const& t_)
        {(t_.*f_)();}

        int main()
        {
                X x;
                run(&X::f,x);
                boost::bind(&X::f,_1)(x);
        }

>Do you really have a volatile member function somewhere? I thought that they
>were "officially" worthless.

Well, that is a different matter. If one might want to follow Andrei's suggestion of using volatile to encapsulate synchronisation then they are still worthwhile. (CUJ February 2001).


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net