Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2005-02-15 13:40:45


Ben Hutchings <ben.hutchings_at_[hidden]> writes:

> Actually it can:
>
> struct D : C { void foo(std::string); };
>
> mem_fun mf = static_cast<mem_fun>(&D::foo);
>
> Not that I'd recommend doing that, as it invites type errors.

Creating an instance by breaking the type system is cheating. Why not
reinterpret_cast<mem_fun>("foo"), for that matter?

A simpler instance of the type is:

  mem_fun mf = 0;

Cheers,

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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