CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: razzle

Search: Search took 0.04 seconds.

  1. Re: Why is the CRTP used instead of virtual functions?

    No you are wrong. The call of a virtual function is not resolved (or bound as it's also called) at compiletime. The type checking can be performed at compiletime unless a downcast is involved. But...
  2. Re: Why is the CRTP used instead of virtual functions?

    No.

    Polymorphism is polymorphism and it serves the purpose of polymorphic behaviour regardless of when it's resolved, be it at compiletime or runtime.

    The only difference is that the CRTP...
  3. Re: Why is the CRTP used instead of virtual functions?

    This is a flawed argument.

    If devirtualization were required by the standard then it would cease to be an implementation detail.
  4. Re: Why is the CRTP used instead of virtual functions?

    Well, the lack of a devirtualization optimization in most C++ compilers isn't a bug really.

    But it's a pity it's not there already though. And as I've said Java has had it for ages (at least ten...
  5. Re: Why is the CRTP used instead of virtual functions?

    Could you please expand on that. It's complicated stuff you know. :)
  6. Re: Why is the CRTP used instead of virtual functions?

    That's right.

    Superbonzo is opposing OO as a design methology mainly for efficiency reasons and for them devirtualization is the worst nightmare because it renders the efficiency argument moot.
    ...
  7. Re: Why is the CRTP used instead of virtual functions?

    Note that devirtualization optimization cannot make virtual functions calls static if they really need to be dynamic. So devirtualization doesn't remove the need for dynamic calls. It just avoids...
  8. Re: Why is the CRTP used instead of virtual functions?

    Well, with devirtualization the OO approach is as efficient as CRTP.

    Do you understand that?
  9. Re: Why is the CRTP used instead of virtual functions?

    I don't think very many finds it attractive in the sense they use it whenever they can. At least not among OO programmers. I think most view CRTP as a legacy idiom (to be pulled out of the trick bag...
Results 1 to 9 of 9





Click Here to Expand Forum to Full Width

Featured