diff -r 89a9235b47d3 -r ec95fc95e5f3 src/types.h --- a/src/types.h Tue Jul 30 07:16:48 2013 +0300 +++ b/src/types.h Tue Jul 30 07:38:08 2013 +0300 @@ -21,15 +21,15 @@ #include #include -#include +#include #include "common.h" class LDObject; typedef QChar qchar; typedef QString str; -template class ConstVectorReverser; -template using c_rev = ConstVectorReverser; +template class ConstListReverser; +template using c_rev = ConstListReverser; class strconfig; class intconfig; class floatconfig; @@ -134,19 +134,19 @@ // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -// vector +// List // -// Array class that wraps around std::vector +// Array class that wraps around std::deque // ============================================================================= -template class vector { +template class List { public: - typedef typename std::vector::iterator it; - typedef typename std::vector::const_iterator c_it; - typedef typename std::vector::reverse_iterator r_it; - typedef typename std::vector::const_reverse_iterator cr_it; + typedef typename std::deque::iterator it; + typedef typename std::deque::const_iterator c_it; + typedef typename std::deque::reverse_iterator r_it; + typedef typename std::deque::const_reverse_iterator cr_it; - vector () {} - vector (initlist vals) { + List () {} + List (initlist vals) { m_vect = vals; } @@ -192,7 +192,7 @@ return m_vect[m_vect.size () - 1]; } - void push_back (const vector& vals) { + void push_back (const List& vals) { for (const T& val : vals) push_back (val); } @@ -210,7 +210,7 @@ return push_back (value); } - void operator<< (const vector& vals) { + void operator<< (const List& vals) { push_back (vals); } @@ -218,8 +218,8 @@ return pop (value); } - vector reverse () const { - vector rev; + List reverse () const { + List rev; for (const T& val : c_rev (*this)) rev << val; @@ -236,7 +236,7 @@ } void makeUnique () { - // Remove duplicate entries. For this to be effective, the vector must be + // Remove duplicate entries. For this to be effective, the List must be // sorted first. sort (); it pos = std::unique (begin (), end ()); @@ -278,21 +278,21 @@ } private: - std::vector m_vect; + std::deque m_vect; }; // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -// VectorReverser (aka rev) +// ListReverser (aka rev) // -// Helper class used to reverse-iterate vectors in range-for-loops. +// Helper class used to reverse-iterate Lists in range-for-loops. // ============================================================================= -template class VectorReverser { +template class ListReverser { public: - typedef typename vector::r_it it; + typedef typename List::r_it it; - VectorReverser (vector& vect) { + ListReverser (List& vect) { m_vect = &vect; } @@ -305,21 +305,21 @@ } private: - vector* m_vect; + List* m_vect; }; // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= -// ConstVectorReverser (aka c_rev) +// ConstListReverser (aka c_rev) // -// Like VectorReverser, except works on const vectors. +// Like ListReverser, except works on const Lists. // ============================================================================= -template class ConstVectorReverser { +template class ConstListReverser { public: - typedef typename vector::cr_it it; + typedef typename List::cr_it it; - ConstVectorReverser (const vector& vect) { + ConstListReverser (const List& vect) { m_vect = &vect; } @@ -332,11 +332,11 @@ } private: - const vector* m_vect; + const List* m_vect; }; -template using rev = VectorReverser; -template using c_rev = ConstVectorReverser; +template using rev = ListReverser; +template using c_rev = ConstListReverser; // ============================================================================= // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -377,7 +377,7 @@ StringFormatArg (const floatconfig& v); StringFormatArg (const void* v); - template StringFormatArg (const vector& v) { + template StringFormatArg (const List& v) { m_val = "{ "; uint i = 0; @@ -482,7 +482,7 @@ }; // Formatter function -str DoFormat (vector args); +str DoFormat (List args); // printf replacement void doPrint (File& f, initlist args);