Reducing template bloat with inheritance

Posted by benoitj on Stack Overflow See other posts from Stack Overflow or by benoitj
Published on 2010-06-14T13:07:16Z Indexed on 2010/06/14 16:52 UTC
Read the original article Hit count: 211

Does anyone have experience reducing template code bloat using inheritance?

i hesitate rewriting our containers this way:

class vectorBase
{
  public:
    int size();
    void clear();
    int m_size;
    void *m_rawData;
    //....
};

template< typename T > 
class vector : public vectorBase
{
    void push_back( const T& );
    //...

};

I should keep maximum performance while reducing compile time

I'm also wondering why stl implementations do not uses this approach

Thanks for your feedbacks

© Stack Overflow or respective owner

Related posts about c++

Related posts about inheritance