Boost logo

Boost Users :

Subject: Re: [Boost-users] [MPL] implementing a "trait"?
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2014-02-06 16:46:59


On 5/02/2014 20:57, Quoth John M. Dlugosz:
> I see that the archetype provides the typedef, but what's the point of
> the static functions? You have to use the actual concrete type to call
> the right function, so having them declared in the base class doesn't
> let you use them in the manner of a virtual function.

It's not completely silly; given a static method A::F and a class B that
derives from A, then attempting to call B::F will end up calling A::F if
B does not define its own function that hides that. (And in this
context, the base method presumably asserts or something.)

Most compilers will generate a warning with this usage, though, so it's
not really considered good style.


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