inherit.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright Aleksey Gurtovoy 2001-2004
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/mpl for documentation.
  8. // $Id$
  9. // $Date$
  10. // $Revision$
  11. #include <boost/mpl/inherit.hpp>
  12. #include <boost/mpl/aux_/test.hpp>
  13. struct her { typedef her herself; };
  14. struct my { typedef my myself; };
  15. MPL_TEST_CASE()
  16. {
  17. MPL_ASSERT(( is_same<inherit<her>::type, her> ));
  18. typedef inherit<her,my>::type her_my1;
  19. MPL_ASSERT(( is_same<her_my1::herself, her> ));
  20. MPL_ASSERT(( is_same<her_my1::myself, my> ));
  21. typedef inherit<empty_base,her>::type her1;
  22. MPL_ASSERT(( is_same<her1, her> ));
  23. typedef inherit<empty_base,her,empty_base,empty_base>::type her2;
  24. MPL_ASSERT(( is_same<her2, her> ));
  25. typedef inherit<her,empty_base,my>::type her_my2;
  26. MPL_ASSERT(( is_same<her_my2::herself, her> ));
  27. MPL_ASSERT(( is_same<her_my2::myself, my> ));
  28. typedef inherit<empty_base,empty_base>::type empty;
  29. MPL_ASSERT(( is_same<empty, empty_base> ));
  30. }