[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppDeque
A STL container class that supports random access iterators and efficient insertion/deletion at both beginning and end.
Very similar to std::vector.
Output:
Note, however, that using a std::vector in this example yields the same correct results.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppDeque
(C++) std::deque
(pronounciation: 'deck')A STL container class that supports random access iterators and efficient insertion/deletion at both beginning and end.
Very similar to std::vector.
About std::deque<bool>
Avoid std::vector<bool> [1]. One of the alternatives is std::deque<bool>. That this works correctly can be seen by this example code:int main() { std::deque<bool> d; d.push_back(0); d.push_back(69); d.push_back(-69); d.push_back(123); d.push_back(255); while (!d.empty()) { std::cout << d.back() << std::endl; d.pop_back(); } std::cin.get(); return 0; }
- include <iostream>
- include <deque>
Output:
1 1 1 1 0
Note, however, that using a std::vector in this example yields the same correct results.
Links
Reference
- 1) Scott Meyers, Effective STL.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
