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