, ( ):
struct some_policy
{
protected:
~some_policy() { ... }
private:
};
struct some_class : some_policy, some_other_policy { ... };
, . :
struct base_vector
{
protected:
~base_vector() { ... }
};
template <typename T>
struct vector : base_vector
{ ... };
, CRTP. :
template <typename Base>
struct some_concept
{
void do_something { static_cast<Base*>(this)->do_some_other_thing(); }
protected:
~some_concept() { ... }
};
struct some_class : some_concept<some_class> { ... };
, Empty Base Optimization. , , some_class ( ).
template <typename T>
struct some_state_which_can_be_empty { ... };
template <typename T>
struct some_class : private some_state_which_can_be_empty<T> { ... };
, , , , .