allow clients of SmallSet to specify their own comparison function for the set.
authorChris Lattner <sabre@nondot.org>
Thu, 5 Jan 2012 17:35:07 +0000 (17:35 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 5 Jan 2012 17:35:07 +0000 (17:35 +0000)
Patch by Stepan Dyatkovskiy!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147607 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/SmallSet.h

index d03f1bef15b11d98e8e4bb30c1fede7aa676c564..cd117f59ba76ee963781ecdbbcf978a4c53590f8 100644 (file)
@@ -27,13 +27,13 @@ namespace llvm {
 ///
 /// Note that this set does not provide a way to iterate over members in the
 /// set.
-template <typename T, unsigned N>
+template <typename T, unsigned N,  typename C = std::less<T> >
 class SmallSet {
   /// Use a SmallVector to hold the elements here (even though it will never
   /// reach its 'large' stage) to avoid calling the default ctors of elements
   /// we will never use.
   SmallVector<T, N> Vector;
-  std::set<T> Set;
+  std::set<T, C> Set;
   typedef typename SmallVector<T, N>::const_iterator VIterator;
   typedef typename SmallVector<T, N>::iterator mutable_iterator;
 public: