Advertisement
eliasdaler

MetaStuff + CRTP

Jun 27th, 2018
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. struct Base
  2. {
  3.     virtual json serialize() const = 0;
  4. };
  5.  
  6. template <typename T>
  7. struct BaseCRTP : Base
  8. {
  9.     json serialize() const override { return meta::serialize(static_cast<const T&>(*this)); }
  10. };
  11.  
  12. struct Hero : BaseCRTP<Hero>
  13. {
  14.    
  15. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement