3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/inherit.html
| Prev Next | Back Along | Up Home | Full TOC | Front Page / Metafunctions / Miscellaneous / inherit |
template<
typename T1, typename T2
>
struct[inherit](./inherit.html)2{
typedef_unspecified_type;
};_..._template<
typename T1, typename T2,_..._typename T_n_>
struct[inherit](./inherit.html)_n_{
typedef_unspecified_type;
};
template<
typename T1
, typename T2_..._, typename T_n_=_unspecified_>
struct[inherit](./inherit.html){
typedef_unspecified_type;
};
Returns an unspecified class type publically derived from T1, T2,... Tn. Guarantees that derivation from empty_base is always a no-op, regardless of the position and number of empty_base classes in T1, T2,... Tn.
#include <[boost/mpl/inherit.hpp](../../../../boost/mpl/inherit.hpp)>
| Parameter | Requirement | Description |
|---|---|---|
| T1, T2,... Tn | A class type | Classes to derived from. |
For artibrary class types _t_1,_t_2,... _t_n:
typedef inherit2<t1,t2>::type r;
| Return type: |
A class type.
| | Precondition: |
t1 and t2 are complete types.
| | Semantics: |
If both t1 and t2 are identical to empty_base, equivalent to
typedef[empty\_base](./empty-base.html)r;
otherwise, if t1 is identical to empty_base, equivalent to
typedef t2 r;
otherwise, if t2 is identical to empty_base, equivalent to
typedef t1 r;
otherwise equivalent to
struct r : t1, t2 {};
|
typedef[inherit](./inherit.html)_n_<t1,t2,_..._t_n_>::type r;
| Return type: |
A class type.
| | Precondition: |
_t_1,_t_2,... _t_n are complete types.
| | Semantics: |
Equivalent to
struct r
:[inherit](./inherit.html)2<[inherit](./inherit.html)_n-1_<t1,t2,_..._t_n-1_>::type
, t_n_>
{
};
|
typedef[inherit](./inherit.html)<t1,t2,_..._t_n_>::type r;
| Precondition: |
_t_1,_t_2,... _t_n are complete types.
| | Return type: |
A class type.
| | Semantics: |
Equivalent to
typedef[inherit](./inherit.html)_n_<t1,t2,_..._t_n_>::type r;
|
Amortized constant time.
struct udt1 { int n; };
struct udt2 {};
typedef[inherit](./inherit.html)<udt1,udt2>::type r1;
typedef[inherit](./inherit.html)<[empty\_base](./empty-base.html),udt1>::type r2;
typedef[inherit](./inherit.html)<[empty\_base](./empty-base.html),udt1,[empty\_base](./empty-base.html),[empty\_base](./empty-base.html)>::type r3;
typedef[inherit](./inherit.html)<udt1,[empty\_base](./empty-base.html),udt2>::type r4;
typedef[inherit](./inherit.html)<[empty\_base](./empty-base.html),[empty\_base](./empty-base.html)>::type r5;[BOOST\_MPL\_ASSERT](./assert.html)(( is_base_and_derived< udt1, r1> ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_base_and_derived< udt2, r1> ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same< r2, udt1> ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same< r3, udt1 > ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_base_and_derived< udt1, r4 > ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_base_and_derived< udt2, r4 > ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same< r5,[empty\_base](./empty-base.html)> ));
Metafunctions, empty_base, inherit_linearly, identity
| Prev Next | Back Along | Up Home | Full TOC |
Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |