stack.h 734 B

1234567891011121314151617181920212223
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_CONTAINERS_STACK_H_
  5. #define BASE_CONTAINERS_STACK_H_
  6. #include <stack>
  7. #include "base/containers/circular_deque.h"
  8. namespace base {
  9. // Provides a definition of base::stack that's like std::stack but uses a
  10. // base::circular_deque instead of std::deque. Since std::stack is just a
  11. // wrapper for an underlying type, we can just provide a typedef for it that
  12. // defaults to the base circular_deque.
  13. template <class T, class Container = circular_deque<T>>
  14. using stack = std::stack<T, Container>;
  15. } // namespace base
  16. #endif // BASE_CONTAINERS_STACK_H_