From: helly Date: Tue, 25 Oct 2005 20:05:59 +0000 (+0000) Subject: - Use set instead of list which is the better option & definitively faster X-Git-Tag: 0.13.6~602 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6901800a77eafa5c5de0f1d0eb5a3ea8ce038a02;p=re2c - Use set instead of list which is the better option & definitively faster --- diff --git a/globals.h b/globals.h index 23365503..65fc51da 100644 --- a/globals.h +++ b/globals.h @@ -3,28 +3,26 @@ #define _globals_h #include "basics.h" -#include +#include #include template -class label_list: protected std::list<_Ty> +class label_list: protected std::set<_Ty> { public: label_list() - : std::list<_Ty>() + : std::set<_Ty>() { } void append(const _Ty &val) { - push_back(val); - std::list<_Ty>::sort(); - std::list<_Ty>::unique(); + std::set<_Ty>::insert(val); } bool contains(const _Ty &val) { - return std::find(std::list<_Ty>::begin(), std::list<_Ty>::end(), val) != std::list<_Ty>::end(); + return find(val) != std::set<_Ty>::end(); } };