template
<
template <typename, typename>
class storage_t,
typename T,
typename is_allocated
>
class Buffer : public storage_t<T, is_allocated> { ... };
template
<
template <typename, typename>
class storage_t,
typename T = storage::UnknownType,
typename is_allocated = std::false_type
>
class Example_Buffer
: public Buffer<storage_t, T, is_allocated> {
constexpr Example_Buffer(
typename storage_t<T, is_allocated>::iterator it) {}
};
Example_Buffer<...>
继承自Buffer<...>
。Buffer<storage_t, T, is_allocated>
继承自storage_t<T, is_allocated>
。storage_t<...>
包括typedefs
和静态 constexpr 数据。有没有办法通过继承访问这些typedefs
和static constexpr data
构造函数?Example_Buffer
(通过继承,也就是不使用storage_t<T, is_allocated>
? 在同一个类中使用这种语法两次感觉有点奇怪。
随意问我是否需要详细说明。