diff --git a/base/internal/message.hpp b/base/internal/message.hpp index ee6487b9cd..f9775a9a15 100644 --- a/base/internal/message.hpp +++ b/base/internal/message.hpp @@ -1,5 +1,6 @@ #pragma once #include "std/array.hpp" +#include "std/deque.hpp" #include "std/functional.hpp" #include "std/initializer_list.hpp" #include "std/iterator.hpp" @@ -100,6 +101,11 @@ template inline string DebugPrint(vector const & v) return ::my::impl::DebugPrintSequence(v.begin(), v.end()); } +template inline string DebugPrint(deque const & d) +{ + return ::my::impl::DebugPrintSequence(d.begin(), d.end()); +} + template inline string DebugPrint(list const & v) { return ::my::impl::DebugPrintSequence(v.begin(), v.end()); diff --git a/base/stl_helpers.hpp b/base/stl_helpers.hpp index 0121e12613..99ff06305a 100644 --- a/base/stl_helpers.hpp +++ b/base/stl_helpers.hpp @@ -1,6 +1,7 @@ #pragma once #include "std/algorithm.hpp" +#include "std/auto_ptr.hpp" #include "std/functional.hpp" #include "std/utility.hpp" #include "std/vector.hpp" @@ -80,28 +81,29 @@ struct Equals }; } // namespace impl -// Sorts and removes duplicate entries from |v|. -template -void SortUnique(vector & v) +// Sorts and removes duplicate entries from |c|. +template > class Container> +void SortUnique(Container & c) { - sort(v.begin(), v.end()); - v.erase(unique(v.begin(), v.end()), v.end()); + sort(c.begin(), c.end()); + c.erase(unique(c.begin(), c.end()), c.end()); } -// Sorts according to |comp| and removes duplicate entries according to |pred| from |v|. +// Sorts according to |comp| and removes duplicate entries according to |pred| from |c|. // Note. If several entries are equal according to |pred| an arbitrary entry of them -// is left in |v| after a call of this function. -template -void SortUnique(vector & v, TLess && less, TEquals && equals) +// is left in |c| after a call of this function. +template > class Container, + typename TLess, typename TEquals> +void SortUnique(Container & c, TLess && less, TEquals && equals) { - sort(v.begin(), v.end(), forward(less)); - v.erase(unique(v.begin(), v.end(), forward(equals)), v.end()); + sort(c.begin(), c.end(), forward(less)); + c.erase(unique(c.begin(), c.end(), forward(equals)), c.end()); } -template -void EraseIf(vector & v, TFn && fn) +template > class Container, class TFn> +void EraseIf(Container & c, TFn && fn) { - v.erase(remove_if(v.begin(), v.end(), forward(fn)), v.end()); + c.erase(remove_if(c.begin(), c.end(), forward(fn)), c.end()); } // Creates a comparer being able to compare two instances of class C diff --git a/std/auto_ptr.hpp b/std/auto_ptr.hpp index 1197110b43..565d835a22 100644 --- a/std/auto_ptr.hpp +++ b/std/auto_ptr.hpp @@ -6,6 +6,7 @@ #include using std::auto_ptr; +using std::allocator; #ifdef DEBUG_NEW #define new DEBUG_NEW