From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-02-05 17:06:47
> The std::stack and std::queue adaptors should work well of course.
> What I have done is just simply adding a static constant,
> "static_max_size", to there interface. Here is the complete
> implementation of my fixed_capacity_stack.
> template<class T, std::size_t N,
> template<class, std::size_t> class C = fixed_capacity_vector>
> class fixed_capacity_stack : public std::stack<T, C<T, N> >
> static const std::size_t static_max_size = C<T, N>::static_max_size;
> }; // fixed_capacity_stack
That's the wrong way of doing it. You don't inherit from a class just to add
data members and/or functions. (It's true it was a popular idiom in early
Check out THE C++ Seminar: 3 Days with 5 Experts
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk