C++ CRTP and accessing derived's nested typedefs from base

前端 未结 3 2026
名媛妹妹
名媛妹妹 2021-02-05 10:58

edit: I\'ll put a github link here when I am done altering my design for anyone who is interested.

Background

I\'m replacing a

3条回答
  •  忘了有多久
    2021-02-05 12:01

    There's no need for the traits class. You can just use type_key directly in base.

    You cannot, however, avoid passing the type explicitly to base. At the time base is instantiated, the typedef in derived has not yet been seen by the compiler (more exactly: the class derived is not yet complete — how could it, given that even its base class doesn't exist yet).

提交回复
热议问题