Advertisement
frasl

Untitled

Feb 18th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. class A {
  2. };
  3.  
  4. class B : public A {
  5. };
  6.  
  7. class C {
  8. };
  9.  
  10. template <typename T> class base_test {
  11.     static_assert(std::is_base_of<A, T>::value, "Template argument must be derived from A");
  12. };
  13.  
  14. int main() {
  15.     base_test<B> bt1;
  16.     base_test<C> bt2; // Error
  17.  
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement